[Bug 240398] -D_XOPEN_SOURCE=500 incorrectly warns about missing snprintf()

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Sat Sep 7 22:35:27 UTC 2019


            Bug ID: 240398
           Summary: -D_XOPEN_SOURCE=500 incorrectly warns about missing
           Product: Base System
           Version: CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: standards
          Assignee: standards at FreeBSD.org
          Reporter: jbeich at FreeBSD.org

$ cat a.c
#define _XOPEN_SOURCE 500
#include <stdio.h>

int main()
  char dest[255], src[] = "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 declaration
for 'snprintf'
1 error generated.

According to

  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

      The snprintf() function is new in Issue 5.

Example fix - https://github.com/dragonflybsd/dragonflybsd/commit/626be21490

You are receiving this mail because:
You are the assignee for the bug.

More information about the freebsd-standards mailing list