buglwIP - A Lightweight TCP/IP stack - Bugs: bug #56003, `-Wc++-compat` causes build...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #56003: `-Wc++-compat` causes build failure when using mbedtls

Submitter:  Freddie Chopin <freddie_chopin>
Submitted:  Tue 26 Mar 2019 10:07:38 AM UTC
   
 
Category:  apps Severity:  3 - Normal
Item Group:  Compiler Warning Status:  Fixed
Privacy:  Public Assigned to:  None
Open/Closed:  Closed Planned Release:  None
lwIP version:  git head

Tue 26 Mar 2019 07:12:15 PM UTC, comment #5: 

Fixed using your suggestion. Thanks for reporting!

Dirk Ziegelmeier <dziegel>
Group administrator
Tue 26 Mar 2019 11:42:05 AM UTC, comment #4: 

I guess you refer to my previous bug report, where `-Wc++-compat` (and others) was a problem for C++. This is unrelated issue - `-Wc++-compat` is still added for GCC/Clang for C projects and lwip/mbedtls are C projects (;

I can provide a patch too - it would just move adding this flag from line 56 to line 71.

http://git.savannah.nongnu.org/cgit/lwip.git/tree/contrib/ports/CMakeCommon.cmake

However, I'm not 100% certain whether just disabling the warning (which I obviously did locally [; ) is not just masking out the problem, which will bite me when using TLS in a C++ project. But fixing that would probably mean a change to mbedtls - they have no bug reports (yet) for this problematic struct definition.

Freddie Chopin <freddie_chopin>
Tue 26 Mar 2019 11:39:41 AM UTC, comment #3: 

No, his report is that mbedTLS headers are not compatible with -Wc++-compat :-((

Dirk Ziegelmeier <dziegel>
Group administrator
Tue 26 Mar 2019 11:30:39 AM UTC, comment #2: 

'git' head, not 'for' head...

Simon Goldschmidt <goldsimon>
Group administrator
Tue 26 Mar 2019 11:29:56 AM UTC, comment #1: 

Wait, isn't this fixed in for head?

Simon Goldschmidt <goldsimon>
Group administrator
Tue 26 Mar 2019 10:07:38 AM UTC, original submission:  

1. Add mbedtls 2.16.0 to a project with lwip
2. Add `set(LWIP_MBEDTLSDIR ${CMAKE_CURRENT_SOURCE_DIR}/mbedtls)` for your project in proper place.
3. Build.

Build fails with:

-- >8 -- >8 -- >8 -- >8 -- >8 -- >8 -- >8 -- >8 -- >8 --

FAILED: CMakeFiles/lwipmbedtls.dir/lwip/src/apps/altcp_tls/altcp_tls_mbedtls.c.o
/usr/bin/cc -DLWIP_HAVE_MBEDTLS=1 -I../ -I../lwip/src/include -I../lwip/contrib/ports/unix/port/include -I../mbedtls/include -g   -fdiagnostics-color=always -Og -g -Wall -pedantic -Werror -Wparentheses -Wsequence-point -Wswitch-default -Wextra -Wundef -Wshadow -Wpointer-arith -Wcast-qual -Wc++-compat -Wwrite-strings -Wold-style-definition -Wcast-align -Wmissing-prototypes -Wnested-externs -Wunreachable-code -Wuninitialized -Waggregate-return -Wlogical-not-parentheses -Wlogical-op -Wtrampolines -MD -MT CMakeFiles/lwipmbedtls.dir/lwip/src/apps/altcp_tls/altcp_tls_mbedtls.c.o -MF CMakeFiles/lwipmbedtls.dir/lwip/src/apps/altcp_tls/altcp_tls_mbedtls.c.o.d -o CMakeFiles/lwipmbedtls.dir/lwip/src/apps/altcp_tls/altcp_tls_mbedtls.c.o   -c ../lwip/src/apps/altcp_tls/altcp_tls_mbedtls.c
In file included from ../lwip/src/apps/altcp_tls/altcp_tls_mbedtls.c:81:
../mbedtls/include/mbedtls/ssl_internal.h:416:16: error: struct defined in struct or union is not visible in C++ [-Werror=c++-compat]
 typedef struct mbedtls_ssl_hs_buffer mbedtls_ssl_hs_buffer;
                ^~~~~~~~~~~~~~~~~~~~~
../mbedtls/include/mbedtls/ssl_internal.h:339:16: note: struct defined here
         struct mbedtls_ssl_hs_buffer
                ^~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors

-- >8 -- >8 -- >8 -- >8 -- >8 -- >8 -- >8 -- >8 -- >8 --

This is because `-Wc++-compat` is added unconditionally to `LWIP_COMPILER_FLAGS_GNU_CLANG` in lwip/contrib/ports/CMakeCommon.cmake.

Freddie Chopin <freddie_chopin>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by dziegel (Posted a comment)
  • -email is unavailable- added by goldsimon (Posted a comment)
  • -email is unavailable- added by freddie_chopin (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-03-26 dziegel StatusNone Fixed
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code