https://bugs.llvm.org/show_bug.cgi?id=43848

            Bug ID: 43848
           Summary: Annex K functions
           Product: clang
           Version: 8.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C11
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected], [email protected],
                    [email protected]

I was expecting to see something along the lines of "Annex K functions not
supported" or "__STDC_LIB_EXT1__ not defined" if memcmp_s was not declared, but
clang seems to be ignoring the -std=c11 flag and interpreting this as C99 code
instead.

// memcmp.c
#define __STDC_WANT_LIB_EXT1__ 1                                                
#include <string.h>

int main()
{
        char dst[10], src[10];
        memcmp_s(dst, 10, src, 10);
}

$ clang -std=c11 memcmp.c -o memcmp.exe
memcmp.c:7:2: warning: implicit declaration of function 'memcmp_s' is invalid
in C99 [-Wimplicit-function-declaration]
        memcmp_s(dst, 10, src, 10);
        ^
1 warning generated.
/usr/bin/ld: /tmp/memcmp-b97369.o: in function `main':
memcmp.c:(.text+0x1c): undefined reference to `memcmp_s'
clang: error: linker command failed with exit code 1 (use -v to see invocation)


This is clang 8.0.0-3 on x86_64-pc-linux-gnu

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to