llvm-project/clang/test/Headers
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
..
Inputs [Clang] Add attributes alloc_size and alloc_align to mm_malloc 2022-02-17 19:59:18 +01:00
altivec-header.c
altivec-intrin.c Use functions with prototypes when appropriate; NFC 2022-02-09 17:16:10 -05:00
amdgcn-openmp-device-math-complex.c [OpenMP][AMDGCN] Enable complex functions 2021-08-24 12:40:41 +05:30
amdgcn-openmp-device-math-complex.cpp [AMDGPU][OpenMP] Use complex definitions from complex_cmath.h 2021-09-09 10:55:17 +05:30
amdgcn_openmp_device_math.c [OpenMP][AMDGCN] Initial math headers support 2021-08-02 14:38:52 +00:00
arm-acle-header.c Use functions with prototypes when appropriate; NFC 2022-02-09 17:16:10 -05:00
arm-cde-header.c [ARM/AArch64] Move REQUIRES after update_cc_test_checks line. NFC 2021-11-13 19:09:01 +00:00
arm-cmse-header-ns.c [C11/C2x] Change the behavior of the implicit function declaration warning 2022-04-20 11:30:12 -04:00
arm-cmse-header.c
arm-fp16-header.c [ARM/AArch64] Move REQUIRES after update_cc_test_checks line. NFC 2021-11-13 19:09:01 +00:00
arm-neon-header.c [ARM/AArch64] Move REQUIRES after update_cc_test_checks line. NFC 2021-11-13 19:09:01 +00:00
arm64-apple-ios-types.cpp
builtins-header.c [Clang] Add an empty builtins.h file. 2021-07-16 12:50:04 -05:00
c11.c Use functions with prototypes when appropriate; NFC 2022-02-09 17:16:10 -05:00
c89.c
cpuid.c [clang] Add missing header guard in <cpuid.h> 2020-11-10 19:34:25 -08:00
cuda_with_openmp.cu [NFC][OpenMP][CUDA] Add test for using `-x cuda -fopenmp` 2021-07-02 19:03:15 +02:00
cxx11.cpp
float-aix.c [AIX][clang] include_next through clang provided float.h 2022-01-28 13:27:10 -05:00
float-darwin.c
float.c
float16.c
hexagon-audio-headers.c [C11/C2x] Change the behavior of the implicit function declaration warning 2022-04-20 11:30:12 -04:00
hexagon-headers.c [hexagon] Add {hvx,}hexagon_{protos,circ_brev...} 2021-06-30 22:58:56 -05:00
hexagon-hvx-headers.c [hexagon] Add {hvx,}hexagon_{protos,circ_brev...} 2021-06-30 22:58:56 -05:00
hip-header.hip [OpaquePtrs][Clang] Add -no-opaque-pointers to tests (NFC) 2022-04-07 12:09:47 +02:00
htm-header.c
int64-type.c
limits.cpp Revert fad7e491a0 with fixes applied 2022-01-29 08:12:16 -05:00
lit.local.cfg [OpenCL] Add builtin header test 2021-06-10 10:05:53 +01:00
mm3dnow.c
mm_malloc.c [Clang] Add attributes alloc_size and alloc_align to mm_malloc 2022-02-17 19:59:18 +01:00
ms-arm64-intrin.cpp [CodeGen] Inline _byteswap_* builtins. 2022-03-16 16:18:51 -07:00
ms-intrin.cpp
ms-null-ms-header-vs-stddef.cpp
ms-wchar.c
nvptx_device_cmath_functions.c
nvptx_device_cmath_functions.cpp
nvptx_device_cmath_functions_cxx17.cpp
nvptx_device_math_complex.c [OpenMP] Overhaul `declare target` handling 2021-05-06 02:10:41 -05:00
nvptx_device_math_complex.cpp
nvptx_device_math_functions.c
nvptx_device_math_functions.cpp
nvptx_device_math_functions_cxx17.cpp
nvptx_device_math_macro.cpp
nvptx_device_math_modf.cpp
nvptx_device_math_sin.c
nvptx_device_math_sin.cpp
nvptx_device_math_sin_cos.cpp
nvptx_device_math_sincos.cpp
opencl-builtins.cl [OpenCL] Add builtin header test 2021-06-10 10:05:53 +01:00
opencl-c-header.cl [SPIR-V] Add SPIR-V triple and clang target info. 2021-11-08 13:34:10 +00:00
openmp_device_math_isnan.cpp [OpenMP][AMDGCN] Initial math headers support 2021-08-02 14:38:52 +00:00
pconfigintin.c
pmmintrin.c
ppc-intrinsics.c
riscv-vector-header.c [RISCV] Remove experimental prefix from rvv-related extensions. 2022-01-22 20:18:40 -08:00
sgxintrin.c
stdarg-gnuc_va_list.c
stdarg.cpp [OpaquePtrs][Clang] Add -no-opaque-pointers to tests (NFC) 2022-04-07 12:09:47 +02:00
stdatomic-deprecations.c Mark ATOMIC_VAR_INIT and ATOMIC_FLAG_INIT as deprecated 2022-01-18 13:41:56 -05:00
stdatomic.c
stdbool.c [clang][sema] Enable first-class bool support for C2x 2022-03-09 15:04:24 +01:00
stdbool.cpp
stddefneeds.cpp
stdint-typeof-MINMAX.cpp
stdint.c Support the *_WIDTH macros in limits.h and stdint.h 2022-01-13 11:46:34 -05:00
target_include_new.cpp [OpenMP] Make sure classes work on the device as they do on the host 2021-05-06 02:10:30 -05:00
texture_intrinsics.cu [CUDA] Implement experimental support for texture lookups. 2021-10-06 15:15:53 -07:00
tgmath-darwin.c
tgmath.c
thumbv7-apple-ios-types.cpp
typedef_guards.c Use functions with prototypes when appropriate; NFC 2022-02-09 17:16:10 -05:00
unwind.c
wasm.c [Clang] Add -no-opaque-pointers to more tests (NFC) 2022-04-07 12:53:29 +02:00
wasm.cpp
wchar_limits.cpp
wmmintrin.c
x86-header-warnings.c Use functions with prototypes when appropriate; NFC 2022-02-09 17:16:10 -05:00
x86-intrinsics-headers-clean.cpp
x86-intrinsics-headers.c
x86_64-apple-macosx-types.cpp
x86intrin-2.c
x86intrin.c
x86intrin.cpp
xmmintrin-unsupported.c Check supported architectures in sseXYZ/avxXYZ headers 2021-09-14 09:57:54 +02:00
xmmintrin.c [test] Add {{.*}} to make tests immune to dso_local/dso_preemptable/(none) differences 2020-12-30 20:52:01 -08:00