Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Paranoid compiler flags -Wall -Wextra -Wshadow -pedantic-errors #136

Merged
merged 46 commits into from
Oct 5, 2020

Conversation

jcdr
Copy link
Contributor

@jcdr jcdr commented Oct 4, 2020

This branch try to fix the error messages produced by the paranoid flags below:
CXXFLAGS += -Wall -Wextra -Wshadow -pedantic-errors

jcdr added 30 commits October 4, 2020 13:56
…ignedness

erpc/erpcgen/src/erpcgen_lexer.l: In member function ‘virtual int erpcgen::ErpcLexer::yylex()’:
erpc/erpcgen/src/erpcgen_lexer.l:213:52: error: comparison of integer expressions of different signedness: ‘int’ and ‘uint32_t’ {aka ‘unsigned int’} [-Werror=sign-compare]
                                         if (yyleng > m_indents)    // remove indent spaces
                                             ~~~~~~~^~~~~~~~~~~
erpc_c/port/erpc_port_stdlib.cpp:42:6: error: the program should also define ‘void operator delete(void*, std::size_t)’ [-Werror=sized-deallocation]
erpc_c/port/erpc_port_stdlib.cpp:47:6: error: the program should also define ‘void operator delete [](void*, std::size_t)’ [-Werror=sized-deallocation]
erpc/erpc_c/transports/erpc_tcp_transport.cpp: In member function ‘virtual erpc_status_t erpc::TCPTransport::connectClient()’:
erpc/erpc_c/transports/erpc_tcp_transport.cpp:89:33: error: missing initializer for member ‘addrinfo::ai_family’ [-Werror=missing-field-initializers]
     struct addrinfo hints = { 0 };
                                 ^
erpc/erpc_c/transports/erpc_tcp_transport.cpp:89:33: error: missing initializer for member ‘addrinfo::ai_socktype’ [-Werror=missing-field-initializers]
erpc/erpc_c/transports/erpc_tcp_transport.cpp:89:33: error: missing initializer for member ‘addrinfo::ai_protocol’ [-Werror=missing-field-initializers]
erpc/erpc_c/transports/erpc_tcp_transport.cpp:89:33: error: missing initializer for member ‘addrinfo::ai_addrlen’ [-Werror=missing-field-initializers]
erpc/erpc_c/transports/erpc_tcp_transport.cpp:89:33: error: missing initializer for member ‘addrinfo::ai_addr’ [-Werror=missing-field-initializers]
erpc/erpc_c/transports/erpc_tcp_transport.cpp:89:33: error: missing initializer for member ‘addrinfo::ai_canonname’ [-Werror=missing-field-initializers]
erpc/erpc_c/transports/erpc_tcp_transport.cpp:89:33: error: missing initializer for member ‘addrinfo::ai_next’ [-Werror=missing-field-initializers]
jcdr added 16 commits October 4, 2020 15:15
… member of 'this'

Compiling erpc_c/infra/erpc_arbitrated_client_manager.cpp
690In file included from /home/travis/build/EmbeddedRPC/erpc/erpc_c/infra/erpc_arbitrated_client_manager.h:13:0,
691                 from /home/travis/build/EmbeddedRPC/erpc/erpc_c/infra/erpc_arbitrated_client_manager.cpp:10:
692/home/travis/build/EmbeddedRPC/erpc/erpc_c/infra/erpc_client_manager.h: In constructor ‘erpc::RequestContext::RequestContext(uint32_t, erpc::Codec*, bool)’:
693/home/travis/build/EmbeddedRPC/erpc/erpc_c/infra/erpc_client_manager.h:225:5: error: declaration of ‘isOneway’ shadows a member of 'this' [-Werror=shadow]
694     : m_sequence(sequence)
695     ^
…re it compile on project that use them

The paranoid flags are commented out into mk/flags.mk because the
generated code don't yet compile with them.
@jcdr jcdr changed the title Paranoid Paranoid compiler flags -Wall -Wextra -Wshadow -pedantic-errors Oct 4, 2020
@MichalPrincNXP MichalPrincNXP self-requested a review October 5, 2020 13:03
@MichalPrincNXP MichalPrincNXP self-assigned this Oct 5, 2020
Copy link
Member

@MichalPrincNXP MichalPrincNXP left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @jcdr , thank you for this effort! If I understand it correctly, you are interested in the client side only and all the code improvements are client-related (except of the generator and the sniffer). Do you plan to make the similar work for the server side too or is this out of your scope and the rest of eprc code should be updated by NXP? Thank you.

@MichalPrincNXP MichalPrincNXP merged commit 7539f87 into EmbeddedRPC:develop Oct 5, 2020
@jcdr
Copy link
Contributor Author

jcdr commented Oct 5, 2020

Hello @MichalPrincNXP , thank your for merging the pull request so fast :-) It was not intentional to be client side only. I fixed what I have found so far with a 'make test' while removing the comment mark on the CXXFLAGS into mk/flags.mk. How can I test the server side ?

The next step would maybe be to improve the the C code generator to make it create C files that compile with the paranoid flags.

@MichalPrincNXP
Copy link
Member

OK. Looking at changed files I thought that you are solving just the client side as there are client manager files and test sources for the client side changed in your PR. And there are no server-related files updated. I have run the test with removed comment mark on CXXFLAGS and the first error has been reported with the server-related test code. If you are willing to continue solving these compiler issues, please put it into your next PR #139 (I guess this is your intention). Otherwise I will try to finalize the work with the rest files later. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

None yet

2 participants