llvm-project/clang/test/Rewriter
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
..
blockcast3.mm
blockstruct.m Use functions with prototypes when appropriate; NFC 2022-02-12 07:25:06 -05:00
crash.m Use functions with prototypes when appropriate; NFC 2022-02-12 07:25:06 -05:00
finally.m [C11/C2x] Change the behavior of the implicit function declaration warning 2022-04-20 11:30:12 -04:00
func-in-impl.m
id-test-3.m
inner-block-helper-funcs.mm
instancetype-test.mm
ivar-encoding-1.m
ivar-encoding-2.m
line-generation-test.m
lit.local.cfg
metadata-test-1.m
metadata-test-2.m
method-encoding-1.m
missing-dllimport.c
modern-write-bf-abi.mm
no-integrated-preprocessing-64bit.m
no-integrated-preprocessing.m
objc-bool-literal-check-modern.mm
objc-bool-literal-modern-1.mm
objc-bool-literal-modern.mm
objc-encoding-bug-1.m
objc-ivar-receiver-1.m
objc-modern-StretAPI-2.mm
objc-modern-StretAPI-3.mm
objc-modern-StretAPI.mm
objc-modern-boxing.mm
objc-modern-class-init-hooks.mm
objc-modern-class-init.mm
objc-modern-container-subscript.mm
objc-modern-fast-enumeration.mm
objc-modern-getclass-proto.mm
objc-modern-implicit-cast.mm
objc-modern-ivar-receiver-1.mm
objc-modern-linkage-spec.mm
objc-modern-metadata-visibility.mm
objc-modern-numeric-literal.mm
objc-modern-property-attributes.mm
objc-modern-property-bitfield.m
objc-string-concat-1.m
objc-super-test.m
objc-synchronized-1.m Use functions with prototypes when appropriate; NFC 2022-02-12 07:25:06 -05:00
properties.m
property-dot-syntax.mm
protocol-rewrite-1.m
protocol-rewrite-2.m
rewrite-anonymous-union.m
rewrite-api-bug.m
rewrite-block-argument.m
rewrite-block-consts.mm
rewrite-block-ivar-call.mm
rewrite-block-literal-1.mm
rewrite-block-literal.mm
rewrite-block-pointer.mm
rewrite-block-property.m
rewrite-byref-in-nested-blocks.mm
rewrite-byref-vars.mm
rewrite-captured-nested-bvar.c Use functions with prototypes when appropriate; NFC 2022-02-12 07:25:06 -05:00
rewrite-cast-ivar-access.mm
rewrite-cast-ivar-modern-access.mm
rewrite-cast-to-bool.mm
rewrite-category-property.mm
rewrite-constructor-init.mm
rewrite-eh.m
rewrite-elaborated-type.mm
rewrite-extern-c.mm
rewrite-foreach-1.m Use functions with prototypes when appropriate; NFC 2022-02-12 07:25:06 -05:00
rewrite-foreach-2.m [C11/C2x] Change the behavior of the implicit function declaration warning 2022-04-20 11:30:12 -04:00
rewrite-foreach-3.m Use functions with prototypes when appropriate; NFC 2022-02-12 07:25:06 -05:00
rewrite-foreach-4.m Use functions with prototypes when appropriate; NFC 2022-02-12 07:25:06 -05:00
rewrite-foreach-5.m
rewrite-foreach-6.m
rewrite-foreach-7.m Use functions with prototypes when appropriate; NFC 2022-02-12 07:25:06 -05:00
rewrite-foreach-in-block.mm
rewrite-foreach-protocol-id.m
rewrite-forward-class.m
rewrite-forward-class.mm
rewrite-function-decl.mm
rewrite-implementation.mm
rewrite-interface-locals.mm
rewrite-ivar-use.m
rewrite-line-directive.m
rewrite-local-externs-in-block.mm
rewrite-local-static-id.mm
rewrite-message-expr.mm
rewrite-modern-array-literal.mm
rewrite-modern-atautoreleasepool.mm
rewrite-modern-block-consts.mm
rewrite-modern-block-ivar-call.mm
rewrite-modern-block.mm
rewrite-modern-captured-nested-bvar.mm
rewrite-modern-catch.m
rewrite-modern-class.mm
rewrite-modern-container-literal.mm
rewrite-modern-default-property-synthesis.mm
rewrite-modern-extern-c-func-decl.mm
rewrite-modern-ivar-access.mm
rewrite-modern-ivar-use.mm
rewrite-modern-ivars-1.mm
rewrite-modern-ivars-2.mm
rewrite-modern-ivars.mm
rewrite-modern-nested-ivar.mm
rewrite-modern-private-ivars.mm
rewrite-modern-protocol-1.mm
rewrite-modern-protocol.mm
rewrite-modern-qualified-type.mm
rewrite-modern-struct-ivar-1.mm
rewrite-modern-struct-ivar.mm
rewrite-modern-super.mm
rewrite-modern-synchronized.m Use functions with prototypes when appropriate; NFC 2022-02-12 07:25:06 -05:00
rewrite-modern-throw.m Use functions with prototypes when appropriate; NFC 2022-02-12 07:25:06 -05:00
rewrite-modern-try-catch-finally.m Use functions with prototypes when appropriate; NFC 2022-02-12 07:25:06 -05:00
rewrite-modern-try-finally.m Use functions with prototypes when appropriate; NFC 2022-02-12 07:25:06 -05:00
rewrite-modern-typeof.mm
rewrite-nest.m
rewrite-nested-blocks-1.mm
rewrite-nested-blocks-2.mm
rewrite-nested-blocks.mm
rewrite-nested-ivar.mm
rewrite-nested-property-in-blocks.mm
rewrite-no-nextline.mm
rewrite-property-attributes.mm
rewrite-property-set-cfstring.mm
rewrite-protocol-property.mm
rewrite-protocol-qualified.mm
rewrite-protocol-type-1.m
rewrite-qualified-id.mm
rewrite-rewritten-initializer.mm
rewrite-static-block.mm
rewrite-super-message.mm [OpaquePtrs][Clang] Add -no-opaque-pointers to tests (NFC) 2022-04-07 12:09:47 +02:00
rewrite-trivial-constructor.mm
rewrite-try-catch.m [C11/C2x] Change the behavior of the implicit function declaration warning 2022-04-20 11:30:12 -04:00
rewrite-typeof.mm
rewrite-unique-block-api.mm
rewrite-user-defined-accessors.mm
rewrite-vararg.m
rewrite-weak-attr.m Use functions with prototypes when appropriate; NFC 2022-02-12 07:25:06 -05:00
static-type-protocol-1.m
undecl-objc-h.m
undeclared-method-1.m
undef-field-reference-1.m Use functions with prototypes when appropriate; NFC 2022-02-12 07:25:06 -05:00
unnamed-bf-modern-write.mm
va-method.m
weak_byref_objects.m Use functions with prototypes when appropriate; NFC 2022-02-12 07:25:06 -05:00