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

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

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

Wilfred
URL:
  <https://savannah.nongnu.org/bugs/?56003>

                 Summary: `-Wc++-compat` causes build failure when using
mbedtls
                 Project: lwIP - A Lightweight TCP/IP stack
            Submitted by: freddie_chopin
            Submitted on: Tue 26 Mar 2019 10:07:38 AM UTC
                Category: apps
                Severity: 3 - Normal
              Item Group: Compiler Warning
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any
         Planned Release: None
            lwIP version: git head

    _______________________________________________________

Details:

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.




    _______________________________________________________

Reply to this item at:

  <https://savannah.nongnu.org/bugs/?56003>

_______________________________________________
  Message sent via Savannah
  https://savannah.nongnu.org/


_______________________________________________
lwip-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-devel
Reply | Threaded
Open this post in threaded view
|

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

Wilfred
Follow-up Comment #1, bug #56003 (project lwip):

Wait, isn't this fixed in for head?

    _______________________________________________________

Reply to this item at:

  <https://savannah.nongnu.org/bugs/?56003>

_______________________________________________
  Message sent via Savannah
  https://savannah.nongnu.org/


_______________________________________________
lwip-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-devel
Reply | Threaded
Open this post in threaded view
|

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

Wilfred
Follow-up Comment #2, bug #56003 (project lwip):

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

    _______________________________________________________

Reply to this item at:

  <https://savannah.nongnu.org/bugs/?56003>

_______________________________________________
  Message sent via Savannah
  https://savannah.nongnu.org/


_______________________________________________
lwip-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-devel
Reply | Threaded
Open this post in threaded view
|

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

Wilfred
Follow-up Comment #3, bug #56003 (project lwip):

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

    _______________________________________________________

Reply to this item at:

  <https://savannah.nongnu.org/bugs/?56003>

_______________________________________________
  Message sent via Savannah
  https://savannah.nongnu.org/


_______________________________________________
lwip-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-devel
Reply | Threaded
Open this post in threaded view
|

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

Wilfred
Follow-up Comment #4, bug #56003 (project lwip):

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.

    _______________________________________________________

Reply to this item at:

  <https://savannah.nongnu.org/bugs/?56003>

_______________________________________________
  Message sent via Savannah
  https://savannah.nongnu.org/


_______________________________________________
lwip-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-devel
Reply | Threaded
Open this post in threaded view
|

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

Wilfred
Update of bug #56003 (project lwip):

                  Status:                    None => Fixed                  
             Open/Closed:                    Open => Closed                

    _______________________________________________________

Follow-up Comment #5:

Fixed using your suggestion. Thanks for reporting!

    _______________________________________________________

Reply to this item at:

  <https://savannah.nongnu.org/bugs/?56003>

_______________________________________________
  Message sent via Savannah
  https://savannah.nongnu.org/


_______________________________________________
lwip-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-devel