Menu

#1096 implicit declaration of strtod_l

v1.0 (example)
closed-fixed
None
5
2017-02-02
2017-01-24
No

With gcc-6.3.1 and glibc-2.24, I am getting a warning when building gsoap-2.8.42, which seems to stem from the lack of a #include <stdlib.h>/#include <cstdlib> in the stdsoap main code.

stdsoap2_ck.c: In function soap_s2float:
stdsoap2_ck.c:14146:19: warning: implicit declaration of function strtod_l [-Wimplicit-function-declaration]
       *p = (float)strtod_l(s, &r, SOAP_LOCALE(soap));

Implicit declarations are a problem because the compiler cannot do necessary type conversion (if so needed) to make the right call.

Discussion

  • Jan Engelhardt

    Jan Engelhardt - 2017-01-24

    It seems to need #define _GNU_SOURCE 1 in the c file.

     
  • Robert van Engelen

    stdsoap2.h:698

    #ifndef WITH_NOSTDLIB
    # include <stdlib.h>
    
     
  • Robert van Engelen

    Perhaps this is the right approach for stdsoap2.h:698?

    #ifndef WITH_NOSTDLIB
    # if defined(__gnu_linux__) && defined(WITH_C_LOCALE)
    #  define _GNU_SOURCE 1
    # endif
    # include <stdlib.h>
    
     
  • Jan Engelhardt

    Jan Engelhardt - 2017-01-25

    The define needs to come before any include; if that is guaranteed, seems ok.

    __gnu_linux__ I am not sure, since there is also __gnu_hurd__ for which GNU_SOURCE is likely being needed. Is it not possible to unconditionally enable _GNU_SOURCE if WITH_C_LOCALE is true?

     
  • Robert van Engelen

    Use 2.8.42 stable update. The #define _GNU_SOURCE is moved up, it should be at the right place. However, we can never guarantee that users include stdsoap2.h as the first header before including anything else such as stdlib.h for example. This is really a GNU bug but fortunately most newer systems we test don't show this as an issue.

     
  • Robert van Engelen

    • status: open --> pending-fixed
    • assigned_to: Robert van Engelen
     
  • Jan Engelhardt

    Jan Engelhardt - 2017-01-27

    This strictly concerns the building of gsoap itself, so it should be reasonably controllable by having the define "early" in stdsoap2.cpp (and not in some .h file).

     
  • Robert van Engelen

    • status: pending-fixed --> closed-fixed
     

Log in to post a comment.

MongoDB Logo MongoDB