[bug #55034] apps/smtp.c fails to compile with strict C compatibility because of strnlen

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

[bug #55034] apps/smtp.c fails to compile with strict C compatibility because of strnlen

Jasper Verschueren
URL:
  <https://savannah.nongnu.org/bugs/?55034>

                 Summary: apps/smtp.c fails to compile with strict C
compatibility because of strnlen
                 Project: lwIP - A Lightweight TCP/IP stack
            Submitted by: erlkoenig
            Submitted on: Fri 16 Nov 2018 11:28:25 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: 2.1.1

    _______________________________________________________

Details:

Dear lwIP maintainers,

the apps/smtp.c file fails to compile if the compiler is configured to
strictly observe the C standard (e.g. -std=c11 for GCC), because strnlen is a
POSIX function but not defined by the C standard. Simply setting -std=gnu11
does not work with e.g. newlib, because this results in some system header
#defining BYTE_ORDER, which then conflicts with the BYTE_ORDER from arch.h.

I think the best solution is to either avoid strnlen, or add a "#define
_POSIX_C_SOURCE 200809L" to the top of smtp.h (before all #include's) to
enable strnlen for C libraries that support it (including newlib).

Thanks & greetings,
Niklas



    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: Fri 16 Nov 2018 11:28:25 AM UTC  Name: patch-strnlen-posix.txt  Size:
281B   By: erlkoenig
Patch to add _POSIX_C_SOURCE macro to smtp.c
<http://savannah.nongnu.org/bugs/download.php?file_id=45443>

    _______________________________________________________

Reply to this item at:

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

_______________________________________________
  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 #55034] apps/smtp.c fails to compile with strict C compatibility because of strnlen

Jasper Verschueren
Update of bug #55034 (project lwip):

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

    _______________________________________________________

Follow-up Comment #1:

Fixed, thanks for reporting!

    _______________________________________________________

Reply to this item at:

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

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


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