llvm-project/clang/test/CodeGen/X86
Aaron Ballman 7d644e1215 [C11/C2x] Change the behavior of the implicit function declaration warning
C89 had a questionable feature where the compiler would implicitly
declare a function that the user called but was never previously
declared. The resulting function would be globally declared as
extern int func(); -- a function without a prototype which accepts zero
or more arguments.

C99 removed support for this questionable feature due to severe
security concerns. However, there was no deprecation period; C89 had
the feature, C99 didn't. So Clang (and GCC) both supported the
functionality as an extension in C99 and later modes.

C2x no longer supports that function signature as it now requires all
functions to have a prototype, and given the known security issues with
the feature, continuing to support it as an extension is not tenable.

This patch changes the diagnostic behavior for the
-Wimplicit-function-declaration warning group depending on the language
mode in effect. We continue to warn by default in C89 mode (due to the
feature being dangerous to use). However, because this feature will not
be supported in C2x mode, we've diagnosed it as being invalid for so
long, the security concerns with the feature, and the trivial
workaround for users (declare the function), we now default the
extension warning to an error in C99-C17 mode. This still gives users
an easy workaround if they are extensively using the extension in those
modes (they can disable the warning or use -Wno-error to downgrade the
error), but the new diagnostic makes it more clear that this feature is
not supported and should be avoided. In C2x mode, we no longer allow an
implicit function to be defined and treat the situation the same as any
other lookup failure.

Differential Revision: https://reviews.llvm.org/D122983
2022-04-20 11:30:12 -04:00
..
3dnow-builtins.c
32bit-behavior-no-eval.c [OpaquePtrs][Clang] Add -no-opaque-pointers to tests (NFC) 2022-04-07 12:09:47 +02:00
32bit-behavior.c [OpaquePtrs][Clang] Add -no-opaque-pointers to tests (NFC) 2022-04-07 12:09:47 +02:00
adc-builtins.c [OpaquePtrs][Clang] Add -no-opaque-pointers to tests (NFC) 2022-04-07 12:09:47 +02:00
adx-builtins.c [OpaquePtrs][Clang] Add -no-opaque-pointers to tests (NFC) 2022-04-07 12:09:47 +02:00
amx.c [OpaquePtrs][Clang] Add -no-opaque-pointers to tests (NFC) 2022-04-07 12:09:47 +02:00
amx_api.c [X86][AMX] enable amx cast intrinsics in FE. 2022-04-02 14:02:35 +08:00
amx_errors.c
amx_inline_asm.c
att-inline-asm-prefix.c
avx-builtins-constrained-cmp.c [X86][AVX] Add i386 test coverage to avx intrinsic tests 2022-04-20 15:12:11 +01:00
avx-builtins.c [X86][AVX] Add i386 test coverage to avx intrinsic tests 2022-04-20 15:12:11 +01:00
avx-cmp-builtins.c [X86][AVX] Add i386 test coverage to avx intrinsic tests 2022-04-20 15:12:11 +01:00
avx-shuffle-builtins.c [X86][AVX] Add i386 test coverage to avx intrinsic tests 2022-04-20 15:12:11 +01:00
avx-union.c [OpaquePtrs][Clang] Add -no-opaque-pointers to tests (NFC) 2022-04-07 12:09:47 +02:00
avx2-builtins.c [X86][AVX] Add i386 test coverage to avx2 intrinsic tests 2022-04-20 15:12:12 +01:00
avx512-inline-asm-kregisters-basics.c A significant number of our tests in C accidentally use functions 2022-02-13 08:03:40 -05:00
avx512-kconstraints-att_inline_asm.c
avx512-reduceIntrin.c
avx512-reduceMinMaxIntrin.c [test] Remove references to -fexperimental-new-pass-manager in tests 2022-04-11 13:29:08 -07:00
avx512bf16-builtins.c
avx512bitalg-builtins.c
avx512bw-builtins.c [OpaquePtrs][Clang] Add -no-opaque-pointers to tests (NFC) 2022-04-07 12:09:47 +02:00
avx512cdintrin.c
avx512dq-builtins-constrained.c
avx512dq-builtins.c [OpaquePtrs][Clang] Add -no-opaque-pointers to tests (NFC) 2022-04-07 12:09:47 +02:00
avx512er-builtins.c
avx512f-builtins-constrained-cmp.c [test] Remove references to -fexperimental-new-pass-manager in tests 2022-04-11 13:29:08 -07:00
avx512f-builtins-constrained.c [test] Remove references to -fexperimental-new-pass-manager in tests 2022-04-11 13:29:08 -07:00
avx512f-builtins.c [test] Remove references to -fexperimental-new-pass-manager in tests 2022-04-11 13:29:08 -07:00
avx512fp16-abi.c A significant number of our tests in C accidentally use functions 2022-02-13 08:03:40 -05:00
avx512fp16-builtins.c [OpaquePtrs][Clang] Add -no-opaque-pointers to tests (NFC) 2022-04-07 12:09:47 +02:00
avx512fp16-complex-abi.c [OpaquePtrs][Clang] Add -no-opaque-pointers to tests (NFC) 2022-04-07 12:09:47 +02:00
avx512fp16-complex.c Revert "The _Float16 type is supported on x86 systems with SSE2 enabled." 2021-11-23 08:00:57 -05:00
avx512ifma-builtins.c
avx512ifmavl-builtins.c
avx512pf-builtins.c
avx512vbmi-builtins.c
avx512vbmi2-builtins.c [OpaquePtrs][Clang] Add -no-opaque-pointers to tests (NFC) 2022-04-07 12:09:47 +02:00
avx512vbmivl-builtin.c
avx512vl-builtins-constrained-cmp.c [test] Remove references to -fexperimental-new-pass-manager in tests 2022-04-11 13:29:08 -07:00
avx512vl-builtins-constrained.c [test] Remove references to -fexperimental-new-pass-manager in tests 2022-04-11 13:29:08 -07:00
avx512vl-builtins.c [test] Remove references to -fexperimental-new-pass-manager in tests 2022-04-11 13:29:08 -07:00
avx512vlbf16-builtins.c [X86] add 3 missing intrinsics: _mm_(mask/maskz)_cvtpbh_ps 2021-11-18 08:48:19 +08:00
avx512vlbitalg-builtins.c
avx512vlbw-builtins.c [test] Remove references to -fexperimental-new-pass-manager in tests 2022-04-11 13:29:08 -07:00
avx512vlcd-builtins.c
avx512vldq-builtins.c
avx512vlfp16-builtins.c [OpaquePtrs][Clang] Add -no-opaque-pointers to tests (NFC) 2022-04-07 12:09:47 +02:00
avx512vlvbmi2-builtins.c [OpaquePtrs][Clang] Add -no-opaque-pointers to tests (NFC) 2022-04-07 12:09:47 +02:00
avx512vlvnni-builtins.c
avx512vnni-builtins.c
avx512vpopcntdq-builtins.c [X86][AVX512] Rename avx512popcntdq intrinsics tests files to match *-builtins.c naming convention 2022-04-20 15:12:12 +01:00
avx512vpopcntdqvl-builtins.c [X86][AVX512] Rename avx512popcntdq intrinsics tests files to match *-builtins.c naming convention 2022-04-20 15:12:12 +01:00
avxvnni-builtins.c [X86][AVX] Add i386 test coverage to avx-vnni intrinsic tests 2022-04-20 15:12:12 +01:00
bitscan-builtins.c
bmi-builtins.c
bmi2-builtins.c [C11/C2x] Change the behavior of the implicit function declaration warning 2022-04-20 11:30:12 -04:00
builtin-clflushopt.c
builtin-clwb.c
builtin-clzero.c
builtin-movdir.c [OpaquePtrs][Clang] Add -no-opaque-pointers to tests (NFC) 2022-04-07 12:09:47 +02:00
builtin-wbinvd.c
builtin-wbnoinvd.c
cetintrin.c [OpaquePtrs][Clang] Add -no-opaque-pointers to tests (NFC) 2022-04-07 12:09:47 +02:00
cldemote.c [OpaquePtrs][Clang] Add -no-opaque-pointers to tests (NFC) 2022-04-07 12:09:47 +02:00
f16c-builtins-constrained.c
f16c-builtins.c
fma-builtins-constrained.c
fma-builtins.c
fma4-builtins.c [X86][FMA4] Add i386 test coverage to fma4 intrinsic tests 2022-04-20 11:14:18 +01:00
fp-eval-method.c Use functions with prototypes when appropriate; NFC 2022-02-24 15:30:13 -05:00
fsgsbase-builtins.c A significant number of our tests in C accidentally use functions 2022-02-13 08:03:40 -05:00
gfni-builtins.c
intel-avx512vlvp2intersect.c
intel-avx512vp2intersect.c
invpcid.c [OpaquePtrs][Clang] Add -no-opaque-pointers to tests (NFC) 2022-04-07 12:09:47 +02:00
keylocker.c [OpaquePtrs][Clang] Add -no-opaque-pointers to tests (NFC) 2022-04-07 12:09:47 +02:00
long-double-config-size.c [X86][MS] Add 80bit long double support for Windows 2022-02-14 13:32:29 +08:00
lwp-builtins.c [OpaquePtrs][Clang] Add -no-opaque-pointers to tests (NFC) 2022-04-07 12:09:47 +02:00
lzcnt-builtins.c
mmx-builtins.c
mmx-inline-asm-error.c
mmx-inline-asm.c
mmx-shift-with-immediate.c
movbe-builtins.c [OpaquePtrs][Clang] Add -no-opaque-pointers to tests (NFC) 2022-04-07 12:09:47 +02:00
ms-inline-asm-prefix.c
ms-x86-intrinsics.c [OpaquePtrs][Clang] Add -no-opaque-pointers to tests (NFC) 2022-04-07 12:09:47 +02:00
ms_fmul.c [Inline asm] Fix mangle problem when variable used in inline asm. 2022-03-24 09:41:22 +08:00
pause.c A significant number of our tests in C accidentally use functions 2022-02-13 08:03:40 -05:00
pclmul-builtins.c
pku.c A significant number of our tests in C accidentally use functions 2022-02-13 08:03:40 -05:00
popcnt-builtins.c
prefetchw-builtins.c [OpaquePtrs][Clang] Add -no-opaque-pointers to tests (NFC) 2022-04-07 12:09:47 +02:00
ptwrite.c
rd-builtins.c [OpaquePtrs][Clang] Add -no-opaque-pointers to tests (NFC) 2022-04-07 12:09:47 +02:00
rdpid-builtins.c
rdrand-builtins.c
rot-intrinsics.c
rtm-builtins.c
sha-builtins.c
sse-builtins-constrained-cmp.c
sse-builtins-constrained.c
sse-builtins-dbg.c
sse-builtins.c [OpaquePtrs][Clang] Add -no-opaque-pointers to tests (NFC) 2022-04-07 12:09:47 +02:00
sse.c
sse2-builtins-constrained-cmp.c [X86][SSE] Add i386 test coverage to sse2 intrinsic tests 2022-04-20 12:05:10 +01:00
sse2-builtins.c [X86][SSE] Add i386 test coverage to sse2 intrinsic tests 2022-04-20 12:05:10 +01:00
sse3-builtins.c [X86][SSE] Add i386 test coverage to sse3 intrinsic tests 2022-04-20 10:44:28 +01:00
sse4a-builtins.c [X86][SSE] Add i386 test coverage to sse4a intrinsic tests 2022-04-20 10:48:47 +01:00
sse41-builtins.c [X86][SSE] Add i386 test coverage to sse41 intrinsic tests 2022-04-20 11:06:06 +01:00
sse42-builtins.c [X86][SSE] Add i386 test coverage to sse42 intrinsic tests 2022-04-20 11:06:07 +01:00
ssse3-builtins.c [X86][SSE] Add i386 test coverage to ssse3 intrinsic tests 2022-04-20 10:44:28 +01:00
strictfp_builtins.c [OpaquePtrs][Clang] Add -no-opaque-pointers to tests (NFC) 2022-04-07 12:09:47 +02:00
tbm-builtins.c
va-arg-sse.c [OpaquePtrs][Clang] Add -no-opaque-pointers to tests (NFC) 2022-04-07 12:09:47 +02:00
vaes-builtins.c
vpclmulqdq-builtins.c
waitpkg.c [OpaquePtrs][Clang] Add -no-opaque-pointers to tests (NFC) 2022-04-07 12:09:47 +02:00
x86-64-inline-asm.c A significant number of our tests in C accidentally use functions 2022-02-13 08:03:40 -05:00
x86-GCC-inline-asm-Y-constraints.c
x86-atomic-long_double.c [OpaquePtrs][Clang] Add -no-opaque-pointers to tests (NFC) 2022-04-07 12:09:47 +02:00
x86-bswap.c
x86-builtins-vector-width.c
x86-builtins.c [OpaquePtrs][Clang] Add -no-opaque-pointers to tests (NFC) 2022-04-07 12:09:47 +02:00
x86-cf-protection.c
x86-crc-builtins.c [X86] Add CRC32 feature. 2021-09-06 17:24:30 +08:00
x86-enqcmd-builtins.c [OpaquePtrs][Clang] Add -no-opaque-pointers to tests (NFC) 2022-04-07 12:09:47 +02:00
x86-inline-asm-min-vector-width.c [OpaquePtrs][Clang] Add -no-opaque-pointers to tests (NFC) 2022-04-07 12:09:47 +02:00
x86-inline-asm-v-constraint.c
x86-long-double.cpp [Clang/Test]: Rename enable_noundef_analysis to disable-noundef-analysis and turn it off by default 2022-01-16 18:54:17 +09:00
x86-nontemporal.c [OpaquePtrs][Clang] Add -no-opaque-pointers to tests (NFC) 2022-04-07 12:09:47 +02:00
x86-serialize-intrin.c
x86-soft-float.c [Clang/Test]: Rename enable_noundef_analysis to disable-noundef-analysis and turn it off by default 2022-01-16 18:54:17 +09:00
x86-ssc-mark.c A significant number of our tests in C accidentally use functions 2022-02-13 08:03:40 -05:00
x86-tsxldtrk-builtins.c A significant number of our tests in C accidentally use functions 2022-02-13 08:03:40 -05:00
x86-uintr-builtins.c A significant number of our tests in C accidentally use functions 2022-02-13 08:03:40 -05:00
x86-vec-i128.c [OpaquePtrs][Clang] Add -no-opaque-pointers to tests (NFC) 2022-04-07 12:09:47 +02:00
x86-vec-struct-packing.c
x86-vector-width.c A significant number of our tests in C accidentally use functions 2022-02-13 08:03:40 -05:00
x86.c A significant number of our tests in C accidentally use functions 2022-02-13 08:03:40 -05:00
x86_32-arguments-darwin.c [OpaquePtrs][Clang] Add -no-opaque-pointers to tests (NFC) 2022-04-07 12:09:47 +02:00
x86_32-arguments-iamcu.c [OpaquePtrs][Clang] Add -no-opaque-pointers to tests (NFC) 2022-04-07 12:09:47 +02:00
x86_32-arguments-linux.c [OpaquePtrs][Clang] Add -no-opaque-pointers to tests (NFC) 2022-04-07 12:09:47 +02:00
x86_32-arguments-nommx.c [Clang/Test]: Rename enable_noundef_analysis to disable-noundef-analysis and turn it off by default 2022-01-16 18:54:17 +09:00
x86_32-arguments-realign.c [OpaquePtrs][Clang] Add -no-opaque-pointers to tests (NFC) 2022-04-07 12:09:47 +02:00
x86_32-arguments-win32.c [OpaquePtrs][Clang] Add -no-opaque-pointers to tests (NFC) 2022-04-07 12:09:47 +02:00
x86_32-fpcc-struct-return.c
x86_32-inline-asm.c A significant number of our tests in C accidentally use functions 2022-02-13 08:03:40 -05:00
x86_32-xsave.c [OpaquePtrs][Clang] Add -no-opaque-pointers to tests (NFC) 2022-04-07 12:09:47 +02:00
x86_64-PR42672.c [OpaquePtrs][Clang] Add -no-opaque-pointers to tests (NFC) 2022-04-07 12:09:47 +02:00
x86_64-arguments-darwin.c A significant number of our tests in C accidentally use functions 2022-02-13 08:03:40 -05:00
x86_64-arguments-nacl.c [OpaquePtrs][Clang] Add -no-opaque-pointers to tests (NFC) 2022-04-07 12:09:47 +02:00
x86_64-arguments-win32.c [OpaquePtrs][Clang] Add -no-opaque-pointers to tests (NFC) 2022-04-07 12:09:47 +02:00
x86_64-arguments.c [OpaquePtrs][Clang] Add -no-opaque-pointers to tests (NFC) 2022-04-07 12:09:47 +02:00
x86_64-atomic-128.c [OpaquePtrs][Clang] Add -no-opaque-pointers to tests (NFC) 2022-04-07 12:09:47 +02:00
x86_64-floatvectors.c [OpaquePtrs][Clang] Add -no-opaque-pointers to tests (NFC) 2022-04-07 12:09:47 +02:00
x86_64-instrument-functions.c [test] Remove references to -fexperimental-new-pass-manager in tests 2022-04-11 13:29:08 -07:00
x86_64-longdouble.c [OpaquePtrs][Clang] Add -no-opaque-pointers to tests (NFC) 2022-04-07 12:09:47 +02:00
x86_64-mno-sse.c Revert "[X86][clang] Emit diagnostic for float and double when we have features -x87 and -sse on 64-bits" 2021-12-10 10:31:09 +08:00
x86_64-mno-sse2.c A significant number of our tests in C accidentally use functions 2022-02-13 08:03:40 -05:00
x86_64-profiling-keep-fp.c
x86_64-xsave.c [OpaquePtrs][Clang] Add -no-opaque-pointers to tests (NFC) 2022-04-07 12:09:47 +02:00
x86_inlineasm_curly_bracket_escape.c A significant number of our tests in C accidentally use functions 2022-02-13 08:03:40 -05:00
xop-builtins-cmp.c [XOP] Add i386 test coverage to xop intrinsic tests 2022-04-20 10:44:27 +01:00
xop-builtins.c [XOP] Add i386 test coverage to xop intrinsic tests 2022-04-20 10:44:27 +01:00