Date: Sat, 07 Sep 2019 22:35:27 +0000 From: bugzilla-noreply@freebsd.org To: standards@FreeBSD.org Subject: [Bug 240398] -D_XOPEN_SOURCE=500 incorrectly warns about missing snprintf() Message-ID: <bug-240398-99@https.bugs.freebsd.org/bugzilla/>
next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D240398 Bug ID: 240398 Summary: -D_XOPEN_SOURCE=3D500 incorrectly warns about missing snprintf() Product: Base System Version: CURRENT Hardware: Any OS: Any Status: New Severity: Affects Only Me Priority: --- Component: standards Assignee: standards@FreeBSD.org Reporter: jbeich@FreeBSD.org $ cat a.c #define _XOPEN_SOURCE 500 #include <stdio.h> int main() { char dest[255], src[] =3D "Hello"; snprintf(dest, sizeof(dest), "%s", src); } $ cc -Werror a.c a.c:7:3: error: implicitly declaring library function 'snprintf' with type = 'int (char *, unsigned long, const char *, ...)' [-Werror,-Wimplicit-function-declaration] snprintf(dest, sizeof(dest), "%s", src); ^ a.c:7:3: note: include the header <stdio.h> or explicitly provide a declara= tion for 'snprintf' 1 error generated. According to https://pubs.opengroup.org/onlinepubs/9699919799/functions/fprintf.html Issue 5 Aligned with ISO/IEC 9899:1990/Amendment 1:1995 (E). Specifically, the l (ell) qualifier can now be used with c and s conversion specifiers. The snprintf() function is new in Issue 5. Example fix - https://github.com/dragonflybsd/dragonflybsd/commit/626be21490 --=20 You are receiving this mail because: You are the assignee for the bug.=
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-240398-99>