On 11/09/2020 23:39, Gert Doering wrote: [...snip...] >> I'm getting a lot of "warning: implicit declaration of function >> ???strdup???;" and >> "warning: assignment to ???char *??? from ???int??? makes pointer from >> integer >> without a cast" compiler warning on all of these strdup() calls. >> >> We do use strdup() in the main openvpn code, but that code includes config.h, >> which contains #define _GNU_SOURCE 1. This removes this compiler warning. >> >> This is on RHEL-7 with both gcc-4.8 and gcc-9.3. > > Not sure what you are hitting there. According to "man strdup()", > inclusion of <string.h> should be fully sufficient, without any extra > declarations. But maybe it's a -std=... thing to tell GCC what > C language level is desired?
Yes, I read somewhere that -std=c99 changes the behavior. _POSIX_C_SOURCE is not defined with -std=c99 (nor c11), but is defined without -std= defined. None of the compiler standards adds _XOPEN_SOURCE - and neither _SVID_SOURCE nor _BSD_SOURCE (which is not really surprising) > I developed and tested this on a gentoo linux, with gcc-9.2.0, and it's > *not* throwing strdup() warnings. Without -std=c99 I get a clean compilation with GCC-9.3.1 (RHEL-7/devtoolset-9 SCL). But on stock RHEL-7 (GCC-4.8.5) this plugin does not compile without -std=c99 ... ------------------------ client-connect/sample-client-connect.c: In function ‘openvpn_plugin_client_connect’: client-connect/sample-client-connect.c:356:9: error: ‘for’ loop initial declarations are only allowed in C99 mode for (int i = 0; argv[i]; i++) ------------------------ -- kind regards, David Sommerseth OpenVPN Inc
signature.asc
Description: OpenPGP digital signature
_______________________________________________ Openvpn-devel mailing list Openvpn-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openvpn-devel