llvm-project/clang/test/SemaOpenCL
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
..
access-qualifier.cl [OpenCL] Supports optional same image reads and writes in C++ for OpenCL 2021 2021-09-17 14:14:31 +01:00
address-spaces-conversions-cl2.0.cl Use functions with prototypes when appropriate; NFC 2022-03-31 13:45:39 -04:00
address-spaces.cl [C89/C2x] Improve diagnostics around strict prototypes in C 2022-04-08 16:19:58 -04:00
amdgpu-attrs.cl
arithmetic-conversions.cl
arm-integer-dot-product.cl [C11/C2x] Change the behavior of the implicit function declaration warning 2022-04-20 11:30:12 -04:00
array-init.cl Use functions with prototypes when appropriate; NFC 2022-02-07 09:25:01 -05:00
array-parameters.cl
as_type.cl [OpenCL] Add as_size/ptrdiff/intptr/uintptr_t operators 2021-04-07 10:16:41 +01:00
atomic-init.cl
atomic-ops.cl [OpenCL] Add atomic_half type builtins 2021-10-12 10:45:30 +01:00
block-array-capturing.cl [OpaquePtrs][Clang] Add -no-opaque-pointers to tests (NFC) 2022-04-07 12:09:47 +02:00
bool-vectors.cl
builtin.cl
builtins-amdgcn-error-ci.cl
builtins-amdgcn-error-f16.cl
builtins-amdgcn-error-flat-address-space.cl
builtins-amdgcn-error-gfx9.cl
builtins-amdgcn-error-gfx10-param.cl
builtins-amdgcn-error-gfx10.cl
builtins-amdgcn-error-gfx90a-param.cl
builtins-amdgcn-error-gfx908-param.cl
builtins-amdgcn-error-gfx940-param.cl [AMDGPU] Support gfx940 smfmac instructions 2022-03-24 12:40:42 -07:00
builtins-amdgcn-error-vi.cl [AMDGPU] Expose __builtin_amdgcn_perm for v_perm_b32 2021-05-06 16:17:33 -07:00
builtins-amdgcn-error.cl [AMDGPU] Add llvm.amdgcn.s.setprio intrinsic 2022-03-12 22:15:42 -08:00
cl20-device-side-enqueue.cl [C89/C2x] Improve diagnostics around strict prototypes in C 2022-04-08 16:19:58 -04:00
clang-builtin-version.cl [C11/C2x] Change the behavior of the implicit function declaration warning 2022-04-20 11:30:12 -04:00
clk_event_t.cl Use functions with prototypes when appropriate; NFC 2022-03-31 13:45:39 -04:00
cond.cl
convergent.cl
endian-attr.cl
event_t.cl [C++4OpenCL] Add diagnostics for OpenCL types in templates. 2021-04-27 13:04:25 +01:00
event_t_overload.cl
ext_vectors.cl [Clang] Allow "ext_vector_type" applied to Booleans 2022-03-16 11:10:32 +01:00
extension-begin.cl [OpenCL] Drop pragma handling for extension types/decls. 2021-05-17 12:09:43 +01:00
extension-begin.h [OpenCL] Drop pragma handling for extension types/decls. 2021-05-17 12:09:43 +01:00
extension-version.cl [OpenCL] Fix parsing of opencl-c.h in CL 3.0 2021-03-30 16:17:46 +01:00
fdeclare-opencl-builtins.cl [OpenCL] Add device enqueue guards for DSE builtins 2022-04-11 11:27:51 +01:00
features.cl [OpenCL] Define OpenCL 3.0 optional core features in C++ for OpenCL 2021 2021-09-01 10:15:17 +01:00
format-strings-fixit.cl
fp-options.cl [OpenCL] Use -fdeclare-opencl-builtins for some tests 2021-03-22 09:46:28 +00:00
fp64-fp16-options.cl [OpenCL] Supports optional 64-bit floating point types in C++ for OpenCL 2021 2021-09-03 10:58:05 +01:00
func.cl [C89/C2x] Improve diagnostics around strict prototypes in C 2022-04-08 16:19:58 -04:00
half.cl Recommit: Compress formatting of array type names (int [4] -> int[4]) 2021-10-21 11:34:43 -07:00
images.cl
init.cl
intel-subgroup-avc-ext-types.cl [OpenCL] Refactor diagnostic for OpenCL extension/feature 2021-03-12 11:43:53 +03:00
invalid-assignment-constant-address-space.cl Use functions with prototypes when appropriate; NFC 2022-03-31 13:45:39 -04:00
invalid-block.cl Use functions with prototypes when appropriate; NFC 2022-02-07 09:25:01 -05:00
invalid-constant.cl
invalid-device-enqueue-types-cl3.0.cl [OpenCL] Add support of __opencl_c_device_enqueue feature macro. 2022-01-27 14:25:59 +03:00
invalid-image.cl [OpenCL] Fix optional image types. 2021-05-07 13:29:28 +01:00
invalid-kernel-attrs.cl
invalid-kernel-parameters.cl Recommit: Compress formatting of array type names (int [4] -> int[4]) 2021-10-21 11:34:43 -07:00
invalid-kernel.cl
invalid-pipe-builtin-cl2.0.cl Use functions with prototypes when appropriate; NFC 2022-03-31 13:45:39 -04:00
invalid-pipes-cl1.2.cl Use functions with prototypes when appropriate; NFC 2022-03-31 13:45:39 -04:00
invalid-pipes-cl2.0.cl Add -Wno-strict-prototypes to C tests; NFC 2022-02-24 15:30:30 -05:00
invalid-vector-literals.cl
lit.local.cfg
multistep-explicit-cast.cl
nosvm.cl Use functions with prototypes when appropriate; NFC 2022-02-07 09:25:01 -05:00
null_literal.cl [OpenCL] NULL redefined as nullptr in C++ mode. 2021-07-27 16:33:50 +01:00
null_queue.cl Use functions with prototypes when appropriate; NFC 2022-02-07 09:25:01 -05:00
numbered-address-space.cl Add prototypes to functions which need them; NFC 2022-04-01 10:32:46 -04:00
operators.cl
predefined-expr.cl Recommit: Compress formatting of array type names (int [4] -> int[4]) 2021-10-21 11:34:43 -07:00
printf-format-string-warnings.cl [OpenCL] Use -fdeclare-opencl-builtins for some tests 2021-03-22 09:46:28 +00:00
printf-format-strings.cl
queue_t_overload.cl
recovery-expr.cl
sampler_t.cl Use functions with prototypes when appropriate; NFC 2022-03-31 13:45:39 -04:00
sampler_t_overload.cl
shifts.cl Use functions with prototypes when appropriate; NFC 2022-03-31 13:45:39 -04:00
sizeof.cl
storageclass-cl20.cl Use functions with prototypes when appropriate; NFC 2022-03-31 13:45:39 -04:00
storageclass.cl Use functions with prototypes when appropriate; NFC 2022-03-31 13:45:39 -04:00
str_literals.cl
to_addr_builtin.cl [C11/C2x] Change the behavior of the implicit function declaration warning 2022-04-20 11:30:12 -04:00
types.cl
unroll-hint.cl
unsupported-image.cl [OpenCL] Supports optional writing to 3d images in C++ for OpenCL 2021 2021-09-20 10:07:38 +01:00
unsupported.cl [OpenCL] Fix test by adding SPIR triple 2021-05-24 13:03:50 +01:00
usm-address-spaces-conversions.cl
vec_compare.cl Use functions with prototypes when appropriate; NFC 2022-03-31 13:45:39 -04:00
vec_step.cl
vector-conv.cl
vector_inc_dec_ops.cl Use functions with prototypes when appropriate; NFC 2022-03-31 13:45:39 -04:00
vector_swizzle_length.cl Use functions with prototypes when appropriate; NFC 2022-03-31 13:45:39 -04:00
warn-missing-prototypes.cl