Add -Wno-strict-prototypes to C tests; NFC

This patch adds -Wno-strict-prototypes to all of the test cases that
use functions without prototypes, but not as the primary concern of the
test. e.g., attributes testing whether they can/cannot be applied to a
function without a prototype, etc.

This is done in preparation for enabling -Wstrict-prototypes by
default.
This commit is contained in:
Aaron Ballman 2022-02-24 15:30:30 -05:00
parent 1c2558021c
commit 2ceee2f884
94 changed files with 295 additions and 297 deletions

View File

@ -1,4 +1,4 @@
// RUN: %clang_cc1 -triple x86_64-unknown-unknown -ast-dump=json -ast-dump-filter Test %s | FileCheck %s
// RUN: %clang_cc1 -triple x86_64-unknown-unknown -Wno-strict-prototypes -ast-dump=json -ast-dump-filter Test %s | FileCheck %s
#include "Inputs/json-dump-include.h"
@ -16,7 +16,7 @@ struct TestChildren {
};
};
void testLabelDecl() {
void testLabelDecl(void) {
__label__ TestLabelDecl;
TestLabelDecl: goto TestLabelDecl;
}
@ -74,8 +74,8 @@ int TestFunctionDecl(int x, enum { e } y) {
int TestFunctionDecl2(enum Enum { e } x) { return x; }
int TestFunctionDeclProto(int x);
void TestFunctionDeclNoProto();
extern int TestFunctionDeclSC();
inline int TestFunctionDeclInline();
extern int TestFunctionDeclSC(void);
inline int TestFunctionDeclInline(void);
struct testFieldDecl {
int TestFieldDecl;
@ -1574,14 +1574,14 @@ void testParmVarDecl(int TestParmVarDecl);
// CHECK-NEXT: },
// CHECK-NEXT: "end": {
// CHECK-NEXT: "offset": {{[0-9]+}},
// CHECK-NEXT: "col": 31,
// CHECK-NEXT: "col": 35,
// CHECK-NEXT: "tokLen": 1
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: "name": "TestFunctionDeclSC",
// CHECK-NEXT: "mangledName": "TestFunctionDeclSC",
// CHECK-NEXT: "type": {
// CHECK-NEXT: "qualType": "int ()"
// CHECK-NEXT: "qualType": "int (void)"
// CHECK-NEXT: },
// CHECK-NEXT: "storageClass": "extern"
// CHECK-NEXT: }
@ -1604,14 +1604,14 @@ void testParmVarDecl(int TestParmVarDecl);
// CHECK-NEXT: },
// CHECK-NEXT: "end": {
// CHECK-NEXT: "offset": {{[0-9]+}},
// CHECK-NEXT: "col": 35,
// CHECK-NEXT: "col": 39,
// CHECK-NEXT: "tokLen": 1
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: "name": "TestFunctionDeclInline",
// CHECK-NEXT: "mangledName": "TestFunctionDeclInline",
// CHECK-NEXT: "type": {
// CHECK-NEXT: "qualType": "int ()"
// CHECK-NEXT: "qualType": "int (void)"
// CHECK-NEXT: },
// CHECK-NEXT: "inline": true
// CHECK-NEXT: }

View File

@ -1,19 +1,19 @@
// Test without serialization:
// RUN: %clang_cc1 -triple x86_64-unknown-unknown -ast-dump -ast-dump-filter Test %s \
// RUN: %clang_cc1 -triple x86_64-unknown-unknown -Wno-strict-prototypes -ast-dump -ast-dump-filter Test %s \
// RUN: | FileCheck --strict-whitespace %s
//
// Test with serialization:
// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-pch -o %t %s
// RUN: %clang_cc1 -x c -triple x86_64-unknown-unknown -include-pch %t \
// RUN: %clang_cc1 -triple x86_64-unknown-unknown -Wno-strict-prototypes -emit-pch -o %t %s
// RUN: %clang_cc1 -x c -triple x86_64-unknown-unknown -Wno-strict-prototypes -include-pch %t \
// RUN: -ast-dump-all -ast-dump-filter Test /dev/null \
// RUN: | sed -e "s/ <undeserialized declarations>//" -e "s/ imported//" \
// RUN: | FileCheck --strict-whitespace %s
//
// RUN: %clang_cc1 -triple x86_64-unknown-unknown -ast-dump %s \
// RUN: %clang_cc1 -triple x86_64-unknown-unknown -Wno-strict-prototypes -ast-dump %s \
// RUN: | FileCheck -check-prefix CHECK-TU --strict-whitespace %s
//
// RUN: %clang_cc1 -fmodules -fmodules-local-submodule-visibility -fmodule-name=X \
// RUN: -triple x86_64-unknown-unknown -fmodule-map-file=%S/Inputs/module.modulemap \
// RUN: -triple x86_64-unknown-unknown -Wno-strict-prototypes -fmodule-map-file=%S/Inputs/module.modulemap \
// RUN: -ast-dump -ast-dump-filter Test %s -DMODULES \
// RUN: | FileCheck -check-prefix CHECK -check-prefix CHECK-MODULES --strict-whitespace %s
@ -43,7 +43,7 @@ struct TestChildren {
// CHECK-TU: TranslationUnitDecl
void testLabelDecl() {
void testLabelDecl(void) {
__label__ TestLabelDecl;
TestLabelDecl: goto TestLabelDecl;
}
@ -147,11 +147,11 @@ int TestFunctionDeclProto(int x);
void TestFunctionDeclNoProto();
// CHECK: FunctionDecl{{.*}} TestFunctionDeclNoProto 'void ()'
extern int TestFunctionDeclSC();
// CHECK: FunctionDecl{{.*}} TestFunctionDeclSC 'int ()' extern
extern int TestFunctionDeclSC(void);
// CHECK: FunctionDecl{{.*}} TestFunctionDeclSC 'int (void)' extern
inline int TestFunctionDeclInline();
// CHECK: FunctionDecl{{.*}} TestFunctionDeclInline 'int ()' inline
inline int TestFunctionDeclInline(void);
// CHECK: FunctionDecl{{.*}} TestFunctionDeclInline 'int (void)' inline
struct testFieldDecl {
int TestFieldDecl;

View File

@ -1,4 +1,4 @@
// RUN: %clang_analyze_cc1 -triple x86_64-apple-darwin10 -analyzer-checker=core -analyzer-store=region -fblocks -analyzer-opt-analyze-nested-blocks -verify %s
// RUN: %clang_analyze_cc1 -triple x86_64-apple-darwin10 -analyzer-checker=core -analyzer-store=region -fblocks -analyzer-opt-analyze-nested-blocks -verify -Wno-strict-prototypes %s
// RUN: %clang_analyze_cc1 -triple x86_64-apple-darwin10 -analyzer-checker=core -analyzer-store=region -fblocks -analyzer-opt-analyze-nested-blocks -verify -x objective-c++ %s
//===----------------------------------------------------------------------===//

View File

@ -1,7 +1,7 @@
// RUN: %clang_analyze_cc1 -triple x86_64-apple-darwin9 -fenable-matrix -analyzer-checker=core,alpha.core,debug.ExprInspection -analyzer-store=region -Wno-pointer-to-int-cast -verify -analyzer-config eagerly-assume=false %s
// RUN: %clang_analyze_cc1 -triple i386-apple-darwin9 -fenable-matrix -analyzer-checker=core,alpha.core,debug.ExprInspection -analyzer-store=region -Wno-pointer-to-int-cast -verify -analyzer-config eagerly-assume=false %s
// RUN: %clang_analyze_cc1 -triple x86_64-apple-darwin9 -fenable-matrix -analyzer-checker=core,alpha.core,debug.ExprInspection -Wno-pointer-to-int-cast -verify -DEAGERLY_ASSUME=1 -w %s
// RUN: %clang_analyze_cc1 -triple i386-apple-darwin9 -fenable-matrix -analyzer-checker=core,alpha.core,debug.ExprInspection -Wno-pointer-to-int-cast -verify -DEAGERLY_ASSUME=1 -DBIT32=1 -w %s
// RUN: %clang_analyze_cc1 -triple x86_64-apple-darwin9 -fenable-matrix -analyzer-checker=core,alpha.core,debug.ExprInspection -analyzer-store=region -Wno-pointer-to-int-cast -Wno-strict-prototypes -verify -analyzer-config eagerly-assume=false %s
// RUN: %clang_analyze_cc1 -triple i386-apple-darwin9 -fenable-matrix -analyzer-checker=core,alpha.core,debug.ExprInspection -analyzer-store=region -Wno-pointer-to-int-cast -Wno-strict-prototypes -verify -analyzer-config eagerly-assume=false %s
// RUN: %clang_analyze_cc1 -triple x86_64-apple-darwin9 -fenable-matrix -analyzer-checker=core,alpha.core,debug.ExprInspection -Wno-pointer-to-int-cast -Wno-strict-prototypes -verify -DEAGERLY_ASSUME=1 -w %s
// RUN: %clang_analyze_cc1 -triple i386-apple-darwin9 -fenable-matrix -analyzer-checker=core,alpha.core,debug.ExprInspection -Wno-pointer-to-int-cast -Wno-strict-prototypes -verify -DEAGERLY_ASSUME=1 -DBIT32=1 -w %s
extern void clang_analyzer_eval(_Bool);

View File

@ -1,4 +1,4 @@
// RUN: %clang_analyze_cc1 -analyzer-checker=core,debug.ExprInspection -verify %s
// RUN: %clang_analyze_cc1 -analyzer-checker=core,debug.ExprInspection -Wno-strict-prototypes -verify %s
void clang_analyzer_eval(int);
void clang_analyzer_checkInlined(int);

View File

@ -1,4 +1,4 @@
// RUN: %clang_analyze_cc1 -analyzer-store=region -verify %s \
// RUN: %clang_analyze_cc1 -Wno-strict-prototypes -analyzer-store=region -verify %s \
// RUN: -analyzer-checker=core \
// RUN: -analyzer-checker=alpha.deadcode.UnreachableCode \
// RUN: -analyzer-checker=alpha.core.CastSize \

View File

@ -1,5 +1,5 @@
// RUN: %clang_analyze_cc1 -triple i386-apple-darwin9 -analyzer-checker=core,alpha.core.CastToStruct,alpha.security.ReturnPtrRange,alpha.security.ArrayBound -analyzer-store=region -verify -fblocks -analyzer-opt-analyze-nested-blocks -Wno-objc-root-class %s
// RUN: %clang_analyze_cc1 -triple x86_64-apple-darwin9 -DTEST_64 -analyzer-checker=core,alpha.core.CastToStruct,alpha.security.ReturnPtrRange,alpha.security.ArrayBound -analyzer-store=region -verify -fblocks -analyzer-opt-analyze-nested-blocks -Wno-objc-root-class %s
// RUN: %clang_analyze_cc1 -triple i386-apple-darwin9 -analyzer-checker=core,alpha.core.CastToStruct,alpha.security.ReturnPtrRange,alpha.security.ArrayBound -analyzer-store=region -verify -fblocks -analyzer-opt-analyze-nested-blocks -Wno-objc-root-class -Wno-strict-prototypes %s
// RUN: %clang_analyze_cc1 -triple x86_64-apple-darwin9 -DTEST_64 -analyzer-checker=core,alpha.core.CastToStruct,alpha.security.ReturnPtrRange,alpha.security.ArrayBound -analyzer-store=region -verify -fblocks -analyzer-opt-analyze-nested-blocks -Wno-objc-root-class -Wno-strict-prototypes %s
typedef long unsigned int size_t;
void *memcpy(void *, const void *, size_t);

View File

@ -1,6 +1,6 @@
// NOTE: Use '-fobjc-gc' to test the analysis being run twice, and multiple reports are not issued.
// RUN: %clang_analyze_cc1 -triple i386-apple-darwin10 -analyzer-checker=core,alpha.core,osx.cocoa.AtSync -analyzer-store=region -Wno-pointer-to-int-cast -verify -fblocks -Wno-unreachable-code -Wno-null-dereference -Wno-objc-root-class %s
// RUN: %clang_analyze_cc1 -triple x86_64-apple-darwin10 -analyzer-checker=core,alpha.core,osx.cocoa.AtSync -analyzer-store=region -Wno-pointer-to-int-cast -verify -fblocks -Wno-unreachable-code -Wno-null-dereference -Wno-objc-root-class %s
// RUN: %clang_analyze_cc1 -triple i386-apple-darwin10 -analyzer-checker=core,alpha.core,osx.cocoa.AtSync -analyzer-store=region -Wno-strict-prototypes -Wno-pointer-to-int-cast -verify -fblocks -Wno-unreachable-code -Wno-null-dereference -Wno-objc-root-class %s
// RUN: %clang_analyze_cc1 -triple x86_64-apple-darwin10 -analyzer-checker=core,alpha.core,osx.cocoa.AtSync -analyzer-store=region -Wno-strict-prototypes -Wno-pointer-to-int-cast -verify -fblocks -Wno-unreachable-code -Wno-null-dereference -Wno-objc-root-class %s
#ifndef __clang_analyzer__
#error __clang_analyzer__ not defined

View File

@ -1,5 +1,5 @@
// RUN: %clang_analyze_cc1 -triple i386-apple-darwin10 -Wno-tautological-constant-compare -Wtautological-unsigned-zero-compare -analyzer-checker=core,deadcode,alpha.core -std=gnu99 -analyzer-store=region -analyzer-purge=none -verify %s -Wno-error=return-type
// RUN: %clang_analyze_cc1 -triple i386-apple-darwin10 -Wno-tautological-constant-compare -Wtautological-unsigned-zero-compare -analyzer-checker=core,deadcode,alpha.core -std=gnu99 -analyzer-store=region -verify %s -Wno-error=return-type
// RUN: %clang_analyze_cc1 -triple i386-apple-darwin10 -Wno-strict-prototypes -Wno-tautological-constant-compare -Wtautological-unsigned-zero-compare -analyzer-checker=core,deadcode,alpha.core -std=gnu99 -analyzer-store=region -analyzer-purge=none -verify %s -Wno-error=return-type
// RUN: %clang_analyze_cc1 -triple i386-apple-darwin10 -Wno-strict-prototypes -Wno-tautological-constant-compare -Wtautological-unsigned-zero-compare -analyzer-checker=core,deadcode,alpha.core -std=gnu99 -analyzer-store=region -verify %s -Wno-error=return-type
typedef unsigned uintptr_t;

View File

@ -1,8 +1,8 @@
// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -debug-info-kind=limited -o - %s | \
// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -debug-info-kind=limited -Wno-strict-prototypes -o - %s | \
// RUN: FileCheck %s -check-prefix=CHECK -check-prefix=SSE -check-prefix=NO-AVX512
// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -debug-info-kind=limited -o - %s -target-feature +avx | \
// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -debug-info-kind=limited -Wno-strict-prototypes -o - %s -target-feature +avx | \
// RUN: FileCheck %s -check-prefix=CHECK -check-prefix=AVX -check-prefix=NO-AVX512
// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -debug-info-kind=limited -o - %s -target-feature +avx512f | \
// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -debug-info-kind=limited -Wno-strict-prototypes -o - %s -target-feature +avx512f | \
// RUN: FileCheck %s -check-prefix=CHECK -check-prefix=AVX -check-prefix=AVX512
#include <stdarg.h>

View File

@ -1,4 +1,4 @@
// RUN: %clang_cc1 -emit-llvm -fcf-protection=branch -triple i386-linux-gnu %s -o - | FileCheck %s
// RUN: %clang_cc1 -emit-llvm -Wno-strict-prototypes -fcf-protection=branch -triple i386-linux-gnu %s -o - | FileCheck %s
// CHECK: @t5 = weak{{.*}} global i32 2
int t5 __attribute__((weak)) = 2;

View File

@ -1,4 +1,4 @@
// RUN: %clang_cc1 -triple i386-unknown-unknown %s -emit-llvm -o - -fblocks | FileCheck %s
// RUN: %clang_cc1 -triple i386-unknown-unknown %s -emit-llvm -Wno-strict-prototypes -o - -fblocks | FileCheck %s
// CHECK: %[[STRUCT_BLOCK_DESCRIPTOR:.*]] = type { i32, i32 }

View File

@ -1,4 +1,4 @@
// RUN: %clang %s -O0 -emit-llvm -S -o - | FileCheck %s
// RUN: %clang %s -O0 -Wno-strict-prototypes -emit-llvm -S -o - | FileCheck %s
// This should call rb_define_global_function, not rb_f_chop.
void rb_define_global_function (const char*,void(*)(void),int);

View File

@ -1,4 +1,4 @@
// RUN: %clang_cc1 -triple armv7-apple-unknown -ffp-exception-behavior=strict -fexperimental-strict-floating-point -emit-llvm -o - %s -fexceptions -exception-model=sjlj -fblocks | FileCheck %s
// RUN: %clang_cc1 -triple armv7-apple-unknown -Wno-strict-prototypes -ffp-exception-behavior=strict -fexperimental-strict-floating-point -emit-llvm -o - %s -fexceptions -exception-model=sjlj -fblocks | FileCheck %s
// Verify strictfp attributes on invoke calls (and therefore also on
// function definitions).

View File

@ -1,5 +1,5 @@
// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -o - %s -fexceptions -fblocks | FileCheck %s
// RUN: %clang_cc1 -triple armv7-apple-unknown -emit-llvm -o - %s -fexceptions -exception-model=sjlj -fblocks | FileCheck %s -check-prefix=CHECK-ARM
// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -Wno-strict-prototypes -emit-llvm -o - %s -fexceptions -fblocks | FileCheck %s
// RUN: %clang_cc1 -triple armv7-apple-unknown -Wno-strict-prototypes -emit-llvm -o - %s -fexceptions -exception-model=sjlj -fblocks | FileCheck %s -check-prefix=CHECK-ARM
// rdar://problem/8621849
void test1(void) {

View File

@ -1,4 +1,4 @@
// RUN: %clang_cc1 -triple x86_64-unknown-unknown %s -emit-llvm -o - | FileCheck %s
// RUN: %clang_cc1 -triple x86_64-unknown-unknown %s -Wno-strict-prototypes -emit-llvm -o - | FileCheck %s
// PR1895
// sizeof function

View File

@ -1,24 +1,24 @@
// RUN: %clang_cc1 -DD128 -triple x86_64-apple-darwin -fextend-arguments=64 \
// RUN: %s -emit-llvm -o - | FileCheck %s -check-prefix=CHECKEXT
// RUN: -Wno-strict-prototypes %s -emit-llvm -o - | FileCheck %s -check-prefix=CHECKEXT
// When the option isn't selected, no effect
// RUN: %clang_cc1 -DD128 -triple x86_64-apple-darwin \
// RUN: %s -emit-llvm -o - | FileCheck %s \
// RUN: -Wno-strict-prototypes %s -emit-llvm -o - | FileCheck %s \
// RUN: --implicit-check-not "ext {{.*}}to i64"
// The option isn't supported on x86, no effect
// RUN: %clang_cc1 -triple i386-pc-linux-gnu -fextend-arguments=64 \
// RUN: %s -emit-llvm -o - | FileCheck %s \
// RUN: -Wno-strict-prototypes %s -emit-llvm -o - | FileCheck %s \
// RUN: --implicit-check-not "ext {{.*}}to i64"
// The option isn't supported on ppc, no effect
// RUN: %clang_cc1 -triple ppc64le -fextend-arguments=64 \
// RUN: %s -emit-llvm -o - | FileCheck %s \
// RUN: -Wno-strict-prototypes %s -emit-llvm -o - | FileCheck %s \
// RUN: --implicit-check-not "ext {{.*}}to i64"
// The option isn't supported on ppc, no effect
// RUN: %clang_cc1 -DD128 -triple powerpc64-ibm-aix-xcoff -fextend-arguments=64 \
// RUN: %s -emit-llvm -o - | FileCheck %s \
// RUN: -Wno-strict-prototypes %s -emit-llvm -o - | FileCheck %s \
// RUN: --implicit-check-not "ext {{.*}}to i64"

View File

@ -1,4 +1,4 @@
// RUN: %clang_cc1 %s -triple i386-unknown-unknown -emit-llvm -o - -verify | FileCheck %s
// RUN: %clang_cc1 %s -triple i386-unknown-unknown -Wno-strict-prototypes -emit-llvm -o - -verify | FileCheck %s
int g();
@ -19,7 +19,7 @@ void test3(T f) {
int a(int);
int a() {return 1;}
void f0() {}
void f0(void) {}
// CHECK-LABEL: define{{.*}} void @f0()
void f1();
@ -31,13 +31,13 @@ void f2(void) {
void f1() {}
// CHECK: define {{.*}} @f3{{\(\)|\(.*sret.*\)}}
struct foo { int X, Y, Z; } f3() {
struct foo { int X, Y, Z; } f3(void) {
while (1) {}
}
// PR4423 - This shouldn't crash in codegen
void f4() {}
void f5() { f4(42); } //expected-warning {{too many arguments}}
void f5(void) { f4(42); } //expected-warning {{too many arguments}}
// Qualifiers on parameter types shouldn't make a difference.
static void f6(const float f, const float g) {
@ -52,7 +52,7 @@ void f7(float f, float g) {
struct Incomplete;
void f8_callback(struct Incomplete);
void f8_user(void (*callback)(struct Incomplete));
void f8_test() {
void f8_test(void) {
f8_user(&f8_callback);
// CHECK-LABEL: define{{.*}} void @f8_test()
// CHECK: call void @f8_user({{.*}}* noundef bitcast (void ()* @f8_callback to {{.*}}*))
@ -62,6 +62,6 @@ void f8_test() {
// PR10204: don't crash
static void test9_helper(void) {}
void test9() {
void test9(void) {
(void) test9_helper;
}

View File

@ -1,4 +1,4 @@
// RUN: %clang_cc1 -triple x86_64-apple-darwin -emit-llvm -o - %s | FileCheck %s
// RUN: %clang_cc1 -triple x86_64-apple-darwin -Wno-strict-prototypes -emit-llvm -o - %s | FileCheck %s
// CHECK: ModuleID
// CHECK: target triple = "
// CHECK-NOT: opaque
@ -12,4 +12,4 @@ enum teste1 { TEST1 };
struct tests2 { int x,y,z,a,b,c,d,e,f,g; };
struct tests3 { float x; };
void f0() {}
void f0(void) {}

View File

@ -1,8 +1,8 @@
// REQUIRES: x86-registered-target
//
// RUN: echo "GNU89 tests:"
// RUN: %clang_cc1 %s -triple i386-unknown-unknown -O1 -disable-llvm-passes -emit-llvm -o - -std=gnu89 | FileCheck %s --check-prefix=CHECK1
// RUN: %clang_cc1 %s -triple i386-unknown-unknown -fexperimental-new-pass-manager -O1 -disable-llvm-passes -emit-llvm -o - -std=gnu89 | FileCheck %s --check-prefix=CHECK1
// RUN: %clang_cc1 %s -triple i386-unknown-unknown -Wno-strict-prototypes -O1 -disable-llvm-passes -emit-llvm -o - -std=gnu89 | FileCheck %s --check-prefix=CHECK1
// RUN: %clang_cc1 %s -triple i386-unknown-unknown -Wno-strict-prototypes -fexperimental-new-pass-manager -O1 -disable-llvm-passes -emit-llvm -o - -std=gnu89 | FileCheck %s --check-prefix=CHECK1
// CHECK1-LABEL: define{{.*}} i32 @foo()
// CHECK1-LABEL: define{{.*}} i32 @bar()
// CHECK1-LABEL: define{{.*}} void @unreferenced1()
@ -24,8 +24,8 @@
// CHECK1-LABEL: define available_externally void @gnu_ei_inline()
// RUN: echo "C99 tests:"
// RUN: %clang_cc1 %s -triple i386-unknown-unknown -O1 -disable-llvm-passes -emit-llvm -o - -std=gnu99 | FileCheck %s --check-prefix=CHECK2
// RUN: %clang_cc1 %s -triple i386-unknown-unknown -fexperimental-new-pass-manager -O1 -disable-llvm-passes -emit-llvm -o - -std=gnu99 | FileCheck %s --check-prefix=CHECK2
// RUN: %clang_cc1 %s -triple i386-unknown-unknown -Wno-strict-prototypes -O1 -disable-llvm-passes -emit-llvm -o - -std=gnu99 | FileCheck %s --check-prefix=CHECK2
// RUN: %clang_cc1 %s -triple i386-unknown-unknown -Wno-strict-prototypes -fexperimental-new-pass-manager -O1 -disable-llvm-passes -emit-llvm -o - -std=gnu99 | FileCheck %s --check-prefix=CHECK2
// CHECK2-LABEL: define{{.*}} i32 @ei()
// CHECK2-LABEL: define{{.*}} i32 @bar()
// CHECK2-NOT: unreferenced1
@ -58,8 +58,8 @@
// CHECK3-LABEL: define linkonce_odr noundef i32 @_Z2eiv()
// RUN: echo "MS C Mode tests:"
// RUN: %clang_cc1 %s -triple i386-pc-win32 -O1 -disable-llvm-passes -emit-llvm -o - -std=c99 | FileCheck %s --check-prefix=CHECK4
// RUN: %clang_cc1 %s -triple i386-pc-win32 -fexperimental-new-pass-manager -O1 -disable-llvm-passes -emit-llvm -o - -std=c99 | FileCheck %s --check-prefix=CHECK4
// RUN: %clang_cc1 %s -triple i386-pc-win32 -Wno-strict-prototypes -O1 -disable-llvm-passes -emit-llvm -o - -std=c99 | FileCheck %s --check-prefix=CHECK4
// RUN: %clang_cc1 %s -triple i386-pc-win32 -Wno-strict-prototypes -fexperimental-new-pass-manager -O1 -disable-llvm-passes -emit-llvm -o - -std=c99 | FileCheck %s --check-prefix=CHECK4
// CHECK4-NOT: define weak_odr void @_Exit(
// CHECK4-LABEL: define weak_odr dso_local i32 @ei()
// CHECK4-LABEL: define dso_local i32 @bar()

View File

@ -1,5 +1,5 @@
// RUN: %clang_cc1 -O1 -fno-experimental-new-pass-manager -std=gnu89 -triple i386-apple-darwin9 -emit-llvm %s -o - | FileCheck -check-prefix CHECK-GNU89 %s
// RUN: %clang_cc1 -O1 -fno-experimental-new-pass-manager -std=c99 -triple i386-apple-darwin9 -emit-llvm %s -o - | FileCheck -check-prefix CHECK-C99 %s
// RUN: %clang_cc1 -Wno-strict-prototypes -O1 -fno-experimental-new-pass-manager -std=gnu89 -triple i386-apple-darwin9 -emit-llvm %s -o - | FileCheck -check-prefix CHECK-GNU89 %s
// RUN: %clang_cc1 -Wno-strict-prototypes -O1 -fno-experimental-new-pass-manager -std=c99 -triple i386-apple-darwin9 -emit-llvm %s -o - | FileCheck -check-prefix CHECK-C99 %s
// CHECK-GNU89-LABEL: define{{.*}} i32 @f0()
// CHECK-C99-LABEL: define{{.*}} i32 @f0()
@ -61,7 +61,7 @@ extern inline int f9(void) { return 0; }
// CHECK-C99-LABEL: define{{.*}} i32 @fB()
int test_all() {
int test_all(void) {
return f0() + f1() + f2() + f3() + f4() + f5() + f6() + f7() + f8() + f9()
+ fA() + fB();
}

View File

@ -1,4 +1,4 @@
// RUN: %clang_cc1 -triple x86_64-pc-win32 -emit-llvm < %s | FileCheck %s
// RUN: %clang_cc1 -triple x86_64-pc-win32 -Wno-strict-prototypes -emit-llvm < %s | FileCheck %s
void __fastcall f1(void);
void __stdcall f2(void);

View File

@ -1,6 +1,6 @@
// RUN: %clang_cc1 -triple i386-pc-linux -emit-llvm < %s | FileCheck %s
// RUN: %clang_cc1 -triple i386-pc-linux -emit-llvm -mrtd < %s | FileCheck %s
// RUN: %clang_cc1 -triple i386-pc-linux -emit-llvm -fms-compatibility < %s
// RUN: %clang_cc1 -triple i386-pc-linux -Wno-strict-prototypes -emit-llvm < %s | FileCheck %s
// RUN: %clang_cc1 -triple i386-pc-linux -Wno-strict-prototypes -emit-llvm -mrtd < %s | FileCheck %s
// RUN: %clang_cc1 -triple i386-pc-linux -Wno-strict-prototypes -emit-llvm -fms-compatibility < %s
void __fastcall f1(void);
void __stdcall f2(void);

View File

@ -1,5 +1,5 @@
// REQUIRES: x86-registered-target
// RUN: %clang_cc1 %s -triple x86_64-apple-darwin10 -fasm-blocks -emit-llvm -o - | FileCheck %s
// RUN: %clang_cc1 %s -triple x86_64-apple-darwin10 -Wno-strict-prototypes -fasm-blocks -emit-llvm -o - | FileCheck %s
void t1(void) {
int var = 10;

View File

@ -1,4 +1,4 @@
// RUN: %clang_cc1 %s -emit-llvm -o - | grep sret | grep -v 'sret.c' | count 4
// RUN: %clang_cc1 %s -Wno-strict-prototypes -emit-llvm -o - | grep sret | grep -v 'sret.c' | count 4
struct abc {
long a;
@ -11,7 +11,7 @@ struct abc {
struct abc foo1(void);
struct abc foo2();
void bar() {
void bar(void) {
struct abc dummy1 = foo1();
struct abc dummy2 = foo2();
}

View File

@ -1,4 +1,4 @@
// RUN: %clang_cc1 -triple i386-unknown-unknown -emit-llvm < %s | FileCheck %s
// RUN: %clang_cc1 -triple i386-unknown-unknown -Wno-strict-prototypes -emit-llvm < %s | FileCheck %s
void __attribute__((fastcall)) f1(void);
void __attribute__((stdcall)) f2(void);

View File

@ -1,4 +1,4 @@
// RUN: %clang_cc1 -Werror -triple i386-linux -emit-llvm -o - %s | FileCheck %s
// RUN: %clang_cc1 -Werror -triple i386-linux -Wno-strict-prototypes -emit-llvm -o - %s | FileCheck %s
// Test that different order of declarations is acceptable and that
// implementing different redeclarations is acceptable.

View File

@ -1,11 +1,11 @@
// This test checks if C functions with internal linkage names are mangled
// and the module hash suffixes attached including emitting DW_AT_linkage_name.
//
// RUN: %clang_cc1 -triple x86_64-unknown-linux -debug-info-kind=limited -dwarf-version=4 -emit-llvm -o - %s | FileCheck %s --check-prefix=PLAIN
// RUN: %clang_cc1 -triple x86_64-unknown-linux -debug-info-kind=limited -dwarf-version=4 -funique-internal-linkage-names -emit-llvm -o - %s | FileCheck %s --check-prefix=UNIQUE
// RUN: %clang_cc1 -triple x86_64-unknown-linux -Wno-strict-prototypes -debug-info-kind=limited -dwarf-version=4 -emit-llvm -o - %s | FileCheck %s --check-prefix=PLAIN
// RUN: %clang_cc1 -triple x86_64-unknown-linux -Wno-strict-prototypes -debug-info-kind=limited -dwarf-version=4 -funique-internal-linkage-names -emit-llvm -o - %s | FileCheck %s --check-prefix=UNIQUE
//
// RUN: %clang_cc1 -triple x86_64-unknown-linux -debug-info-kind=limited -dwarf-version=5 -emit-llvm -o - %s | FileCheck %s --check-prefix=PLAIN
// RUN: %clang_cc1 -triple x86_64-unknown-linux -debug-info-kind=limited -dwarf-version=5 -funique-internal-linkage-names -emit-llvm -o - %s | FileCheck %s --check-prefix=UNIQUE
// RUN: %clang_cc1 -triple x86_64-unknown-linux -Wno-strict-prototypes -debug-info-kind=limited -dwarf-version=5 -emit-llvm -o - %s | FileCheck %s --check-prefix=PLAIN
// RUN: %clang_cc1 -triple x86_64-unknown-linux -Wno-strict-prototypes -debug-info-kind=limited -dwarf-version=5 -funique-internal-linkage-names -emit-llvm -o - %s | FileCheck %s --check-prefix=UNIQUE
static int glob;
// foo should be given a uniquefied name under -funique-internal-linkage-names.

View File

@ -8,7 +8,7 @@
/// treated as VARARGS (in order to place arguments in both registers and
/// memory locations in the back end)
// RUN: %clang_cc1 -triple ve-linux-gnu -emit-llvm %s -o - | FileCheck %s
// RUN: %clang_cc1 -triple ve-linux-gnu -emit-llvm -Wno-strict-prototypes %s -o - | FileCheck %s
// CHECK-LABEL: define{{.*}} signext i8 @fun_si8(i8 noundef signext %a, i8 noundef signext %b) #0 {
char fun_si8(char a, char b) {

View File

@ -1,5 +1,5 @@
// RUN: %clang_cc1 -std=c++11 -triple i686-pc-win32 %s -fms-extensions -fno-rtti -emit-llvm -o - | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-CXX
// RUN: %clang_cc1 -x c -triple i686-pc-win32 %s -fms-extensions -fno-rtti -emit-llvm -o - | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-C
// RUN: %clang_cc1 -x c -Wno-strict-prototypes -triple i686-pc-win32 %s -fms-extensions -fno-rtti -emit-llvm -o - | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-C
// Similar to predefined-expr.cpp, but not as exhaustive, since it's basically
// equivalent to __PRETTY_FUNCTION__.

View File

@ -1,4 +1,4 @@
// RUN: %clang_cc1 -triple i386-apple-darwin9 -fobjc-runtime=macosx-fragile-10.5 -emit-llvm -fblocks -o - %s | FileCheck %s
// RUN: %clang_cc1 -triple i386-apple-darwin9 -fobjc-runtime=macosx-fragile-10.5 -emit-llvm -fblocks -Wno-strict-prototypes -o - %s | FileCheck %s
// CHECK: %[[STRUCT_BLOCK_DESCRIPTOR:.*]] = type { i32, i32 }

View File

@ -1,8 +1,8 @@
// RUN: %clang_cc1 -fsyntax-only %s
// RUN: %clang_cc1 -ast-print %s -o %t.1.c
// RUN: %clang_cc1 -ast-print %t.1.c -o %t.2.c
// RUN: %clang_cc1 -fsyntax-only -Wno-strict-prototypes %s
// RUN: %clang_cc1 -ast-print -Wno-strict-prototypes %s -o %t.1.c
// RUN: %clang_cc1 -ast-print -Wno-strict-prototypes %t.1.c -o %t.2.c
// RUN: diff %t.1.c %t.2.c
// RUN: %clang_cc1 -ast-dump %s
// RUN: %clang_cc1 -ast-dump-all %s
// RUN: %clang_cc1 -ast-dump -Wno-strict-prototypes %s
// RUN: %clang_cc1 -ast-dump-all -Wno-strict-prototypes %s
#include "c-language-features.inc"

View File

@ -1,7 +1,7 @@
// RUN: %clang_cc1 -triple i386-unknown-unknown -emit-llvm -o %t %s
// RUN: %clang_cc1 -triple i386-unknown-unknown -emit-llvm-bc -o %t %s
// RUN: %clang_cc1 -triple i386-unknown-unknown -debug-info-kind=limited -emit-llvm-bc -o %t %s
// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm-bc -o %t %s
// RUN: %clang_cc1 -triple x86_64-unknown-unknown -debug-info-kind=limited -emit-llvm-bc -o %t %s
// RUN: %clang_cc1 -triple i386-unknown-unknown -Wno-strict-prototypes -emit-llvm -o %t %s
// RUN: %clang_cc1 -triple i386-unknown-unknown -Wno-strict-prototypes -emit-llvm-bc -o %t %s
// RUN: %clang_cc1 -triple i386-unknown-unknown -debug-info-kind=limited -Wno-strict-prototypes -emit-llvm-bc -o %t %s
// RUN: %clang_cc1 -triple x86_64-unknown-unknown -Wno-strict-prototypes -emit-llvm-bc -o %t %s
// RUN: %clang_cc1 -triple x86_64-unknown-unknown -debug-info-kind=limited -Wno-strict-prototypes -emit-llvm-bc -o %t %s
#include "c-language-features.inc"

View File

@ -1,3 +1,3 @@
// RUN: %clang_cc1 -emit-html -o %t %s
// RUN: %clang_cc1 -Wno-strict-prototypes -emit-html -o %t %s
#include "c-language-features.inc"

View File

@ -1,5 +1,5 @@
// RUN: rm -rf %t
// RUN: %clang_cc1 -fsyntax-only -I%S/Inputs/malformed-overload -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -verify %s
// RUN: %clang_cc1 -fsyntax-only -I%S/Inputs/malformed-overload -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -Wno-strict-prototypes -verify %s
NSLog(@"%@", path); // expected-error {{expected parameter declarator}} expected-error {{expected ')'}} expected-warning {{type specifier missing}} expected-warning {{incompatible redeclaration}} expected-note {{to match this '('}} expected-note {{'NSLog' is a builtin with type}}
#import "X.h"

View File

@ -2,9 +2,9 @@
// RUN: %clang_cc1 -verify -triple x86_64-unknown-linux -fopenmp -fopenmp-version=51 -std=c++11 \
// RUN: -DNO_INTEROP_T_DEF -o - %s
// RUN: %clang_cc1 -verify -triple x86_64-unknown-linux -fopenmp -fopenmp-version=50 -std=c++11 -o - %s
// RUN: %clang_cc1 -verify -triple x86_64-unknown-linux -fopenmp -fopenmp-version=51 -DC -x c -o - %s
// RUN: %clang_cc1 -verify -triple x86_64-unknown-linux -fopenmp -fopenmp-version=51 -Wno-strict-prototypes -DC -x c -o - %s
// RUN: %clang_cc1 -verify -triple x86_64-pc-windows-msvc -fms-compatibility \
// RUN: -fopenmp -fopenmp-version=51 -DC -DWIN -x c -o - %s
// RUN: -fopenmp -fopenmp-version=51 -Wno-strict-prototypes -DC -DWIN -x c -o - %s
#ifdef NO_INTEROP_T_DEF
void foo_v1(float *, void *);

View File

@ -1,6 +1,5 @@
// RUN: %clang_cc1 -triple=x86_64-pc-win32 -verify -fopenmp -x c -std=c99 -fms-extensions -Wno-pragma-pack %s
// RUN: %clang_cc1 -triple=x86_64-pc-win32 -verify -fopenmp-simd -x c -std=c99 -fms-extensions -Wno-pragma-pack %s
// RUN: %clang_cc1 -triple=x86_64-pc-win32 -verify -fopenmp -std=c99 -fms-extensions -Wno-pragma-pack -Wno-strict-prototypes %s
// RUN: %clang_cc1 -triple=x86_64-pc-win32 -verify -fopenmp-simd -std=c99 -fms-extensions -Wno-pragma-pack -Wno-strict-prototypes %s
#pragma omp declare // expected-error {{expected an OpenMP directive}}

View File

@ -1,9 +1,9 @@
// Test this without pch.
// RUN: %clang_cc1 -fblocks -include %S/types.h -fsyntax-only -verify %s
// RUN: %clang_cc1 -fblocks -include %S/types.h -fsyntax-only -verify -Wno-strict-prototypes %s
// Test with pch.
// RUN: %clang_cc1 -emit-pch -fblocks -o %t %S/types.h
// RUN: %clang_cc1 -fblocks -include-pch %t -fsyntax-only -verify %s -ast-print
// RUN: %clang_cc1 -emit-pch -fblocks -Wno-strict-prototypes -o %t %S/types.h
// RUN: %clang_cc1 -fblocks -include-pch %t -fsyntax-only -verify -Wno-strict-prototypes %s -ast-print
typedef int INT;
INT int_value;

View File

@ -1,4 +1,4 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s -pedantic -std=c99
// RUN: %clang_cc1 -fsyntax-only -verify %s -pedantic -std=c99 -Wno-strict-prototypes
int __attribute__(()) x;

View File

@ -1,5 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -fdouble-square-bracket-attributes -verify %s
// RUN: %clang_cc1 -fsyntax-only -std=gnu2x -verify %s
// RUN: %clang_cc1 -fsyntax-only -fdouble-square-bracket-attributes -verify -Wno-strict-prototypes %s
// RUN: %clang_cc1 -fsyntax-only -std=gnu2x -verify -Wno-strict-prototypes %s
enum [[]] E {
One [[]],

View File

@ -1,4 +1,4 @@
// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -fsyntax-only -verify %s
// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -Wno-strict-prototypes -fsyntax-only -verify %s
void f0() {}
void fun0(void) __attribute((alias("f0")));

View File

@ -1,4 +1,4 @@
// RUN: %clang_cc1 %s -verify
// RUN: %clang_cc1 -Wno-strict-prototypes %s -verify
void *fail1(int a) __attribute__((alloc_size)); //expected-error{{'alloc_size' attribute takes at least 1 argument}}
void *fail2(int a) __attribute__((alloc_size())); //expected-error{{'alloc_size' attribute takes at least 1 argument}}

View File

@ -1,9 +1,9 @@
// RUN: %clang_cc1 -triple thumbv8m.base-none-eabi -mcmse -verify %s
// RUN: %clang_cc1 -triple thumbv8m.base-none-eabi -mcmse -Wno-strict-prototypes -verify %s
typedef void (*callback_ns_1t)() __attribute__((cmse_nonsecure_call));
typedef void (*callback_1t)();
typedef void (*callback_ns_2t)() __attribute__((cmse_nonsecure_call));
typedef void (*callback_2t)();
typedef void (*callback_ns_1t)(void) __attribute__((cmse_nonsecure_call));
typedef void (*callback_1t)(void);
typedef void (*callback_ns_2t)(void) __attribute__((cmse_nonsecure_call));
typedef void (*callback_2t)(void);
void foo(callback_ns_1t nsfptr, // expected-error{{functions may not be declared with 'cmse_nonsecure_call' attribute}}
callback_1t fptr) __attribute__((cmse_nonsecure_call))
@ -14,7 +14,7 @@ void foo(callback_ns_1t nsfptr, // expected-error{{functions may not be declared
callback_ns_2t fp4 = nsfptr;
}
static void bar() __attribute__((cmse_nonsecure_entry)) // expected-warning{{'cmse_nonsecure_entry' cannot be applied to functions with internal linkage}}
static void bar(void) __attribute__((cmse_nonsecure_entry)) // expected-warning{{'cmse_nonsecure_entry' cannot be applied to functions with internal linkage}}
{
}
@ -24,14 +24,14 @@ extern nonsecure_fn_t baz; // expected-error{{functions may not be declared with
int v0 __attribute__((cmse_nonsecure_call)); // expected-warning {{'cmse_nonsecure_call' only applies to function types; type here is 'int'}}
int v1 __attribute__((cmse_nonsecure_entry)); // expected-warning {{'cmse_nonsecure_entry' attribute only applies to functions}}
void fn0() __attribute__((cmse_nonsecure_entry));
void fn1() __attribute__((cmse_nonsecure_entry(1))); // expected-error {{'cmse_nonsecure_entry' attribute takes no arguments}}
void fn0(void) __attribute__((cmse_nonsecure_entry));
void fn1(void) __attribute__((cmse_nonsecure_entry(1))); // expected-error {{'cmse_nonsecure_entry' attribute takes no arguments}}
typedef void (*fn2_t)() __attribute__((cmse_nonsecure_call("abc"))); // expected-error {{'cmse_nonsecure_call' attribute takes no argument}}
typedef void (*fn2_t)(void) __attribute__((cmse_nonsecure_call("abc"))); // expected-error {{'cmse_nonsecure_call' attribute takes no argument}}
union U { unsigned n; char b[4]; } u;
union U xyzzy() __attribute__((cmse_nonsecure_entry)) {
union U xyzzy(void) __attribute__((cmse_nonsecure_entry)) {
return u; // expected-warning {{passing union across security boundary via return value may leak information}}
}
@ -46,7 +46,7 @@ struct S {
};
} s;
void qux() {
void qux(void) {
fn2(1,
u); // expected-warning {{passing union across security boundary via parameter 1 may leak information}}

View File

@ -1,4 +1,4 @@
// RUN: %clang_cc1 -triple x86_64-pc-linux -fsyntax-only -verify -emit-llvm-only %s
// RUN: %clang_cc1 -triple x86_64-pc-linux -Wno-strict-prototypes -fsyntax-only -verify -emit-llvm-only %s
void f1(void) __attribute__((alias("g1")));
void g1(void) {

View File

@ -1,4 +1,4 @@
// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -verify -std=c2x %s
// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -Wno-strict-prototypes -fsyntax-only -verify -std=c2x %s
struct S {};
struct S * [[clang::address_space(1)]] Foo;

View File

@ -1,4 +1,4 @@
// RUN: %clang_cc1 -triple x86_64-linux-gnu -fsyntax-only -verify %s -Wnonnull
// RUN: %clang_cc1 -triple x86_64-linux-gnu -Wno-strict-prototypes -fsyntax-only -verify %s -Wnonnull
void __attribute__((cpu_specific(ivybridge))) no_default(void);
void __attribute__((cpu_specific(sandybridge))) no_default(void);

View File

@ -1,8 +1,8 @@
// RUN: %clang_cc1 -verify -fsyntax-only %s
// RUN: %clang_cc1 -verify -Wno-strict-prototypes -fsyntax-only %s
static void (*fp0)(void) __attribute__((noreturn));
void fatal();
void fatal(void);
static void __attribute__((noreturn)) f0(void) {
fatal();
@ -13,17 +13,17 @@ int f1() __attribute__((noreturn));
int g0 __attribute__((noreturn)); // expected-warning {{'noreturn' only applies to function types; type here is 'int'}}
int f2() __attribute__((noreturn(1, 2))); // expected-error {{'noreturn' attribute takes no arguments}}
int f2(void) __attribute__((noreturn(1, 2))); // expected-error {{'noreturn' attribute takes no arguments}}
void f3() __attribute__((noreturn));
void f3() {
void f3(void) __attribute__((noreturn));
void f3(void) {
return; // expected-warning {{function 'f3' declared 'noreturn' should not return}}
}
#pragma clang diagnostic error "-Winvalid-noreturn"
void f4() __attribute__((noreturn));
void f4() {
void f4(void) __attribute__((noreturn));
void f4(void) {
return; // expected-error {{function 'f4' declared 'noreturn' should not return}}
}

View File

@ -1,4 +1,4 @@
// RUN: %clang_cc1 %s -verify -fsyntax-only
// RUN: %clang_cc1 %s -verify -fsyntax-only -Wno-strict-prototypes
void f1(void) __attribute__((ownership_takes("foo"))); // expected-error {{'ownership_takes' attribute requires parameter 1 to be an identifier}}
void *f2(void) __attribute__((ownership_returns(foo, 1, 2))); // expected-error {{'ownership_returns' attribute takes no more than 1 argument}}

View File

@ -1,5 +1,5 @@
// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -verify %s
// RUN: %clang_cc1 -triple x86_64-unknown-windows -fsyntax-only -verify %s
// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -Wno-strict-prototypes -verify %s
// RUN: %clang_cc1 -triple x86_64-unknown-windows -fsyntax-only -Wno-strict-prototypes -verify %s
#define SWIFTCALL __attribute__((swiftcall))
#define SWIFTASYNCCALL __attribute__((swiftasynccall))

View File

@ -1,4 +1,4 @@
// RUN: %clang_cc1 -triple x86_64-linux-gnu -fsyntax-only -verify %s
// RUN: %clang_cc1 -triple x86_64-linux-gnu -Wno-strict-prototypes -fsyntax-only -verify %s
void __attribute__((target("sse4.2"))) no_default(void);
void __attribute__((target("arch=sandybridge"))) no_default(void);

View File

@ -1,4 +1,4 @@
// RUN: %clang_cc1 -verify -Wunused -Wused-but-marked-unused -Wunused-parameter -Wunused -fsyntax-only %s
// RUN: %clang_cc1 -verify -Wunused -Wused-but-marked-unused -Wunused-parameter -Wunused -Wno-strict-prototypes -fsyntax-only %s
static void (*fp0)(void) __attribute__((unused));
@ -9,14 +9,14 @@ int f1() __attribute__((unused));
int g0 __attribute__((unused));
int f2() __attribute__((unused(1, 2))); // expected-error {{'unused' attribute takes no arguments}}
int f2(void) __attribute__((unused(1, 2))); // expected-error {{'unused' attribute takes no arguments}}
struct Test0_unused {} __attribute__((unused));
struct Test0_not_unused {};
typedef int Int_unused __attribute__((unused));
typedef int Int_not_unused;
void test0() {
void test0(void) {
int x; // expected-warning {{unused variable}}
Int_not_unused i0; // expected-warning {{unused variable}}

View File

@ -1,4 +1,4 @@
// RUN: %clang_cc1 %s -fsyntax-only -verify -pedantic -std=c11
// RUN: %clang_cc1 %s -fsyntax-only -Wno-strict-prototypes -verify -pedantic -std=c11
__auto_type a = 5; // expected-warning {{'__auto_type' is a GNU extension}}
__extension__ __auto_type a1 = 5;

View File

@ -1,9 +1,9 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s -fblocks
// RUN: %clang_cc1 -fsyntax-only -Wno-strict-prototypes -verify %s -fblocks
int (*FP)();
int (^IFP) ();
int (^II) (int);
int main() {
int main(void) {
int (*FPL) (int) = FP; // C doesn't consider this an error.
// For Blocks, the ASTContext::typesAreBlockCompatible() makes sure this is an error.
@ -40,7 +40,7 @@ int main() {
int (^z)() = a+4; // expected-error {{invalid block pointer conversion initializing 'int (^)()' with an expression of type 'int'}}
}
int blah() {
int blah(void) {
int (^IFP) (float);
char (^PCP)(double, double, char);

View File

@ -1,9 +1,9 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s -fblocks
void donotwarn();
// RUN: %clang_cc1 -fsyntax-only -Wno-strict-prototypes -verify %s -fblocks
void donotwarn(void);
int (^IFP) ();
int (^II) (int);
int test1() {
int test1(void) {
int (^PFR) (int) = 0; // OK
PFR = II; // OK
@ -44,7 +44,7 @@ int test2(double (^S)()) {
int^ x; // expected-error {{block pointer to non-function type is invalid}}
int^^ x1; // expected-error {{block pointer to non-function type is invalid}} expected-error {{block pointer to non-function type is invalid}}
void test3() {
void test3(void) {
char *^ y; // expected-error {{block pointer to non-function type is invalid}}
}
@ -72,7 +72,7 @@ void test5() {
}
// rdar://6405429 - __func__ in a block refers to the containing function name.
const char*test6() {
const char*test6(void) {
return ^{
return __func__;
} ();
@ -85,12 +85,12 @@ int test7(void (^p)()) {
}
void test8() {
void test8(void) {
somelabel:
^{ goto somelabel; }(); // expected-error {{use of undeclared label 'somelabel'}}
}
void test9() {
void test9(void) {
goto somelabel; // expected-error {{use of undeclared label 'somelabel'}}
^{ somelabel: ; }();
}
@ -126,7 +126,7 @@ void *test13 = ^{
};
};
void test14() {
void test14(void) {
int X = 32;
static void *P = ^{ // expected-error {{initializer element is not a compile-time constant}}
@ -143,7 +143,7 @@ void foo(long (^comp)()) { // expected-note{{passing argument to parameter 'comp
}
void (^test15f)(void);
void test15() {
void test15(void) {
foo(^{ return LESS; }); // expected-error {{incompatible block pointer types passing 'int (^)(void)' to parameter of type 'long (^)()'}}
}
@ -159,7 +159,7 @@ void test16(__block int i) { // expected-error {{__block attribute not allowed,
void f();
void test17() {
void test17(void) {
void (^bp)(int);
void (*rp)(int);
void (^bp1)();
@ -183,13 +183,13 @@ void test17() {
(void)(0 < bp); // expected-error {{invalid operands to binary expression}}
}
void test18() {
void test18(void) {
void (^const blockA)(void) = ^{ }; // expected-note {{variable 'blockA' declared const here}}
blockA = ^{ }; // expected-error {{cannot assign to variable 'blockA' with const-qualified type 'void (^const)(void)}}
}
// rdar://7072507
int test19() {
int test19(void) {
goto L0; // expected-error {{cannot jump}}
__block int x; // expected-note {{jump bypasses setup of __block variable}}
@ -200,7 +200,7 @@ L0:
}
// radr://7438948
void test20() {
void test20(void) {
int n = 7;
int vla[n]; // expected-note {{declared here}}
int (*vm)[n] = 0; // expected-note {{declared here}}
@ -212,7 +212,7 @@ void test20() {
}
// radr://7438948
void test21() {
void test21(void) {
int a[7]; // expected-note {{declared here}}
__block int b[10]; // expected-note {{declared here}}
a[1] = 1;

View File

@ -1,5 +1,5 @@
// RUN: %clang_cc1 -DSIZE_T_64 -fsyntax-only -triple x86_64-linux -verify %s
// RUN: %clang_cc1 -fsyntax-only -triple i386-freebsd -verify %s
// RUN: %clang_cc1 -DSIZE_T_64 -fsyntax-only -Wno-strict-prototypes -triple x86_64-linux -verify %s
// RUN: %clang_cc1 -fsyntax-only -Wno-strict-prototypes -triple i386-freebsd -verify %s
// __builtin_assume_aligned's second parameter is size_t, which may be 32 bits,
// so test differently when size_t is 32 bits and when it is 64 bits.

View File

@ -1,6 +1,6 @@
// RUN: %clang_cc1 -triple i386-unknown-unknown -fsyntax-only -fno-spell-checking -verify %s
// RUN: %clang_cc1 -triple i386-unknown-unknown -fsyntax-only -fno-spell-checking -Wno-strict-prototypes -verify %s
void invalid_uses() {
void invalid_uses(void) {
struct A {
};
struct A a;
@ -25,7 +25,7 @@ void invalid_uses() {
__builtin_dump_struct(a, goodfunc); // expected-error {{passing 'struct A' to parameter of incompatible type structure pointer: type mismatch at 1st parameter ('struct A' vs structure pointer)}}
}
void valid_uses() {
void valid_uses(void) {
struct A {
};
union B {

View File

@ -1,6 +1,6 @@
/* RUN: %clang_cc1 %s -std=c89 -pedantic -fsyntax-only -verify -Wimplicit-function-declaration
/* RUN: %clang_cc1 %s -std=c89 -pedantic -fsyntax-only -verify -Wimplicit-function-declaration -Wno-strict-prototypes
*/
void test1() {
void test1(void) {
{
int i;
i = i + 1;
@ -36,7 +36,7 @@ int *__restrict; /* expected-error {{expected identifier}} */
/* Implicit int, always ok */
test6() { return 0; }
test6(void) { return 0; }
/* PR2012 */
test7; /* expected-warning {{declaration specifier missing, defaulting to 'int'}} */
@ -79,14 +79,14 @@ void test13b() {
}
/* Make sure we allow *test14 as a "function designator" */
int test14() { return (&*test14)(); }
int test14(void) { return (&*test14)(); }
int test15[5] = { [2] = 1 }; /* expected-warning {{designated initializers are a C99 feature}} */
extern int printf(__const char *__restrict __format, ...);
/* Warn, but don't suggest typo correction. */
void test16() {
void test16(void) {
printg("Hello, world!\n"); /* expected-warning {{implicit declaration of function 'printg'}} */
}
@ -109,9 +109,9 @@ const array_of_CI mine2; /* expected-warning {{duplicate 'const' declaration spe
typedef CI *array_of_pointer_to_CI[5];
const array_of_pointer_to_CI mine3;
void main() {} /* expected-error {{'main' must return 'int'}} */
void main(void) {} /* expected-error {{'main' must return 'int'}} */
const int main() {} /* expected-error {{'main' must return 'int'}} */
const int main(void) {} /* expected-error {{'main' must return 'int'}} */
long long ll1 = /* expected-warning {{'long long' is an extension when C99 mode is not enabled}} */
-42LL; /* expected-warning {{'long long' is an extension when C99 mode is not enabled}} */

View File

@ -1,4 +1,4 @@
// RUN: %clang_cc1 %s -fsyntax-only -triple i686-intel-elfiamcu -verify
// RUN: %clang_cc1 %s -fsyntax-only -Wno-strict-prototypes -triple i686-intel-elfiamcu -verify
void __attribute__((fastcall)) foo(float *a) { // expected-warning {{'fastcall' calling convention is not supported for this target}}
}

View File

@ -1,5 +1,5 @@
// RUN: %clang_cc1 %s -fsyntax-only -triple i386-unknown-unknown -verify
// RUN: %clang_cc1 %s -fsyntax-only -triple i386-unknown-unknown -fms-compatibility -DWIN -verify
// RUN: %clang_cc1 %s -fsyntax-only -Wno-strict-prototypes -triple i386-unknown-unknown -verify
// RUN: %clang_cc1 %s -fsyntax-only -Wno-strict-prototypes -triple i386-unknown-unknown -fms-compatibility -DWIN -verify
void __attribute__((fastcall)) foo(float *a) {
}

View File

@ -1,4 +1,4 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
// RUN: %clang_cc1 -fsyntax-only -verify -Wno-strict-prototypes %s
int x __attribute__((constructor)); // expected-warning {{'constructor' attribute only applies to functions}}
int f(void) __attribute__((constructor));

View File

@ -1,4 +1,4 @@
// RUN: %clang_cc1 -triple i686-pc-win32 -verify %s
// RUN: %clang_cc1 -triple i686-pc-win32 -Wno-strict-prototypes -verify %s
// It's important that this is a .c file.

View File

@ -1,4 +1,4 @@
// RUN: %clang_cc1 %s -verify -fsyntax-only
// RUN: %clang_cc1 %s -verify -fsyntax-only -Wno-strict-prototypes
struct xx { int bitf:1; };
struct entry { struct xx *whatever;

View File

@ -1,4 +1,4 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
// RUN: %clang_cc1 -fsyntax-only -verify -Wno-strict-prototypes %s
// rdar: // 8125274
static int a16[]; // expected-warning {{tentative array definition assumed to have one element}}
@ -24,17 +24,17 @@ static int test1_a[]; // expected-warning {{tentative array definition assumed t
extern int test1_a[];
// rdar://13535367
void test2declarer() { extern int test2_array[100]; }
void test2declarer(void) { extern int test2_array[100]; }
extern int test2_array[];
int test2v = sizeof(test2_array); // expected-error {{invalid application of 'sizeof' to an incomplete type 'int[]'}}
void test3declarer() {
void test3declarer(void) {
{ extern int test3_array[100]; }
extern int test3_array[];
int x = sizeof(test3_array); // expected-error {{invalid application of 'sizeof' to an incomplete type 'int[]'}}
}
void test4() {
void test4(void) {
extern int test4_array[];
{
extern int test4_array[100];
@ -46,24 +46,24 @@ void test4() {
// Test that invalid local extern declarations of library
// builtins behave reasonably.
extern void abort(void); // expected-note 2 {{previous declaration is here}}
extern float *calloc(); // expected-warning {{incompatible redeclaration of library function}} expected-note {{is a builtin}} expected-note 2 {{previous declaration is here}}
void test5a() {
int abort(); // expected-error {{conflicting types}}
float *malloc(); // expected-warning {{incompatible redeclaration of library function}} expected-note 2 {{is a builtin}}
int *calloc(); // expected-error {{conflicting types}}
extern float *calloc(void); // expected-warning {{incompatible redeclaration of library function}} expected-note {{is a builtin}} expected-note 2 {{previous declaration is here}}
void test5a(void) {
int abort(void); // expected-error {{conflicting types}}
float *malloc(void); // expected-warning {{incompatible redeclaration of library function}} expected-note 2 {{is a builtin}}
int *calloc(void); // expected-error {{conflicting types}}
}
void test5b() {
int abort(); // expected-error {{conflicting types}}
float *malloc(); // expected-warning {{incompatible redeclaration of library function}}
int *calloc(); // expected-error {{conflicting types}}
void test5b(void) {
int abort(void); // expected-error {{conflicting types}}
float *malloc(void); // expected-warning {{incompatible redeclaration of library function}}
int *calloc(void); // expected-error {{conflicting types}}
}
void test5c() {
void test5c(void) {
void (*_abort)(void) = &abort;
void *(*_malloc)() = &malloc;
float *(*_calloc)() = &calloc;
}
void test6() {
void test6(void) {
extern int test6_array1[100];
extern int test6_array2[100];
void test6_fn1(int*);

View File

@ -1,4 +1,4 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
// RUN: %clang_cc1 -fsyntax-only -Wno-strict-prototypes -verify %s
// Functions cannot have parameters of type __fp16.
extern void f (__fp16); // expected-error {{parameters cannot have __fp16 type; did you forget * ?}}

View File

@ -1,10 +1,10 @@
// RUN: %clang_cc1 -triple %itanium_abi_triple -fsyntax-only -verify %s
// RUN: %clang_cc1 -triple %itanium_abi_triple -fsyntax-only -Wno-strict-prototypes -verify %s
// PR3588
void g0(int, int);
void g0(); // expected-note{{previous declaration is here}} expected-note{{'g0' declared here}}
void f0() {
void f0(void) {
g0(1, 2, 3); // expected-error{{too many arguments to function call}}
}
@ -29,7 +29,7 @@ INT g2(x) // expected-error{{conflicting types for 'g2'}}
return x;
}
void test() {
void test(void) {
int f1;
{
void f1(double);
@ -45,7 +45,7 @@ void test() {
extern void g3(int); // expected-note{{previous declaration is here}}
static void g3(int x) { } // expected-error{{static declaration of 'g3' follows non-static declaration}}
void test2() {
void test2(void) {
extern int f2; // expected-note 2 {{previous definition is here}}
{
void f2(int); // expected-error{{redefinition of 'f2' as different kind of symbol}}
@ -66,7 +66,7 @@ int outer4(int); // expected-note{{previous declaration is here}}
int outer5; // expected-note{{previous definition is here}}
int *outer7(int);
void outer_test() {
void outer_test(void) {
int outer1(float); // expected-error{{conflicting types for 'outer1'}}
int outer2(int); // expected-note{{previous declaration is here}}
int outer3(int); // expected-note{{previous declaration is here}}
@ -88,7 +88,7 @@ void outer_test2(int x) {
int *ip2 = outer7(x);
}
void outer_test3() {
void outer_test3(void) {
int *(*fp)(int) = outer8; // expected-error{{use of undeclared identifier 'outer8'}}
}
@ -119,7 +119,7 @@ typedef int a();
typedef int a2(int*);
a x;
a2 x2; // expected-note{{passing argument to parameter here}}
void test_x() {
void test_x(void) {
x(5);
x2(5); // expected-warning{{incompatible integer to pointer conversion passing 'int' to parameter of type 'int *'}}
}

View File

@ -1,5 +1,4 @@
// RUN: %clang_cc1 %s -fsyntax-only -verify -verify=c2x -pedantic
// RUN: %clang_cc1 %s -fsyntax-only -std=c2x -verify -pedantic
// RUN: %clang_cc1 %s -fsyntax-only -verify -verify=c2x -pedantic -Wno-strict-prototypes
// PR1892, PR11354
void f(double a[restrict][5]) { __typeof(a) x = 10; } // expected-warning {{(aka 'double (*restrict)[5]')}}

View File

@ -1,5 +1,5 @@
// RUN: %clang_cc1 -std=c11 -fsyntax-only -verify %s
// RUN: %clang_cc1 -std=c99 -pedantic -fsyntax-only -verify=expected,ext %s
// RUN: %clang_cc1 -std=c11 -fsyntax-only -Wno-strict-prototypes -verify %s
// RUN: %clang_cc1 -std=c99 -pedantic -fsyntax-only -Wno-strict-prototypes -verify=expected,ext %s
void g(void);

View File

@ -1,4 +1,4 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
// RUN: %clang_cc1 -fsyntax-only -Wno-strict-prototypes -verify %s
void f() {
int *ptr = malloc(sizeof(int) * 10); // expected-warning{{implicitly declaring library function 'malloc' with type}} \

View File

@ -1,6 +1,6 @@
// RUN: %clang_cc1 -fsyntax-only %s -verify -pedantic
// RUN: %clang_cc1 -fsyntax-only %s -verify -pedantic -Wno-strict-prototypes
foo() { // expected-warning {{type specifier missing, defaults to 'int'}}
foo(void) { // expected-warning {{type specifier missing, defaults to 'int'}}
return 0;
}

View File

@ -1,8 +1,8 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
// RUN: %clang_cc1 -fsyntax-only -Wno-strict-prototypes -verify %s
struct foo; // expected-note 3 {{forward declaration of 'struct foo'}}
struct foo a(); // expected-note {{'a' declared here}}
struct foo a(void); // expected-note {{'a' declared here}}
void b(struct foo);
void c();

View File

@ -1,4 +1,4 @@
// RUN: %clang_cc1 %s -fsyntax-only -verify
// RUN: %clang_cc1 %s -fsyntax-only -Wno-strict-prototypes -verify
// rdar://10095762
typedef void (*Fn_noret)(void) __attribute__((noreturn));

View File

@ -1,6 +1,6 @@
// RUN: %clang_cc1 %s -fsyntax-only -verify
// RUN: %clang_cc1 %s -fsyntax-only -Wno-strict-prototypes -verify
void test() {
void test(void) {
char = 4; // expected-error {{expected identifier}}
}
@ -35,7 +35,7 @@ static void bar(hid_t, char); // expected-error {{expected identifier}}
static void bar(hid_t p, char); // expected-error {{unknown type name 'hid_t'}}
void foo() {
void foo(void) {
(void)bar;
}

View File

@ -1,4 +1,4 @@
// RUN: %clang_cc1 %s -verify -fsyntax-only
// RUN: %clang_cc1 %s -verify -fsyntax-only -Wno-strict-prototypes
void foo(void);
void foo(void) {}

View File

@ -1,4 +1,4 @@
// RUN: %clang_cc1 -fsyntax-only -verify -triple x86_64-pc-linux-gnu %s
// RUN: %clang_cc1 -fsyntax-only -verify -triple x86_64-pc-linux-gnu -Wno-strict-prototypes %s
// CC qualifier can be applied only to functions
int __attribute__((ms_abi)) var1; // expected-warning{{'ms_abi' only applies to function types; type here is 'int'}}

View File

@ -1,4 +1,4 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
// RUN: %clang_cc1 -fsyntax-only -verify -Wno-strict-prototypes %s
// rdar://9584012
//
// Verify All warnings are still issued with the option -fno-delete-null-pointer-checks
@ -30,7 +30,7 @@ void baz(__attribute__((nonnull)) const char *str);
void baz2(__attribute__((nonnull(1))) const char *str); // expected-warning {{'nonnull' attribute when used on parameters takes no arguments}}
void baz3(__attribute__((nonnull)) int x); // expected-warning {{'nonnull' attribute only applies to pointer arguments}}
void test_baz() {
void test_baz(void) {
baz(0); // expected-warning {{null passed to a callee that requires a non-null argument}}
baz2(0); // no-warning
baz3(0); // no-warning
@ -53,12 +53,12 @@ void *test_bad_returns_null(void) {
void PR18795(int (*g)(const char *h, ...) __attribute__((nonnull(1))) __attribute__((nonnull))) {
g(0); // expected-warning{{null passed to a callee that requires a non-null argument}}
}
void PR18795_helper() {
void PR18795_helper(void) {
PR18795(0); // expected-warning{{null passed to a callee that requires a non-null argument}}
}
void vararg1(int n, ...) __attribute__((nonnull(2)));
void vararg1_test() {
void vararg1_test(void) {
vararg1(0);
vararg1(1, (void*)0); // expected-warning{{null passed}}
vararg1(2, (void*)0, (void*)0); // expected-warning{{null passed}}
@ -66,14 +66,14 @@ void vararg1_test() {
}
void vararg2(int n, ...) __attribute__((nonnull, nonnull, nonnull));
void vararg2_test() {
void vararg2_test(void) {
vararg2(0);
vararg2(1, (void*)0); // expected-warning{{null passed}}
vararg2(2, (void*)0, (void*)0); // expected-warning 2{{null passed}}
}
void vararg3(int n, ...) __attribute__((nonnull, nonnull(2), nonnull(3)));
void vararg3_test() {
void vararg3_test(void) {
vararg3(0);
vararg3(1, (void*)0); // expected-warning{{null passed}}
vararg3(2, (void*)0, (void*)0); // expected-warning 2{{null passed}}
@ -127,8 +127,8 @@ int another_evil_nonnull_func(int* pointer, char ch, void * pv) {
}
extern void *returns_null(void**);
extern void FOO();
extern void FEE();
extern void FOO(void);
extern void FEE(void);
extern void *pv;
__attribute__((__nonnull__)) // expected-note {{declared 'nonnull' here}}
@ -158,7 +158,7 @@ void pr21668_2(__attribute__((nonnull)) const char *p) {
;
}
__attribute__((returns_nonnull)) void *returns_nonnull_whee(); // expected-note 6{{declared 'returns_nonnull' here}}
__attribute__((returns_nonnull)) void *returns_nonnull_whee(void); // expected-note 6{{declared 'returns_nonnull' here}}
void returns_nonnull_warning_tests() {
if (returns_nonnull_whee() == NULL) {} // expected-warning {{comparison of nonnull function call 'returns_nonnull_whee()' equal to a null pointer is 'false' on first encounter}}
@ -175,6 +175,6 @@ void returns_nonnull_warning_tests() {
void pr30828(char *p __attribute__((nonnull)));
void pr30828(char *p) {}
void call_pr30828() {
void call_pr30828(void) {
pr30828(0); // expected-warning {{null passed to a callee that requires a non-null argument}}
}

View File

@ -1,4 +1,4 @@
// RUN: %clang_cc1 -fsyntax-only -fdouble-square-bracket-attributes -verify %s -Wincompatible-pointer-types
// RUN: %clang_cc1 -fsyntax-only -fdouble-square-bracket-attributes -verify %s -Wincompatible-pointer-types -Wno-strict-prototypes
int var __attribute__((overloadable)); // expected-error{{'overloadable' attribute only applies to functions}}
void bad_attr_target(int) [[clang::overloadable]]; // expected-error{{'overloadable' attribute cannot be applied to types}}

View File

@ -1,4 +1,4 @@
// RUN: %clang_cc1 -fsyntax-only -verify -pedantic %s
// RUN: %clang_cc1 -fsyntax-only -Wno-strict-prototypes -verify -pedantic %s
char *funk(int format);
enum Test {A=-1};

View File

@ -1,4 +1,4 @@
// RUN: %clang_cc1 %s -fsyntax-only -verify
// RUN: %clang_cc1 %s -fsyntax-only -verify -Wno-strict-prototypes
int f(int a) { return 0; } // expected-note {{previous definition is here}}
int f(int);
int f(int a) { return 0; } // expected-error {{redefinition of 'f'}}

View File

@ -1,112 +1,112 @@
// RUN: %clang_cc1 -triple x86_64-apple-darwin9 %s -fsyntax-only -Wignored-qualifiers -Wno-error=return-type -verify -fblocks -Wno-unreachable-code -Wno-unused-value
// RUN: %clang_cc1 -triple x86_64-apple-darwin9 %s -fsyntax-only -Wignored-qualifiers -Wno-error=return-type -verify -fblocks -Wno-unreachable-code -Wno-unused-value -Wno-strict-prototypes
// clang emits the following warning by default.
// With GCC, -pedantic, -Wreturn-type or -Wall are required to produce the
// following warning.
int t14() {
int t14(void) {
return; // expected-warning {{non-void function 't14' should return a value}}
}
void t15() {
void t15(void) {
return 1; // expected-warning {{void function 't15' should not return a value}}
}
int unknown();
int unknown(void);
void test0() {
void test0(void) {
}
int test1() {
int test1(void) {
} // expected-warning {{non-void function does not return a value}}
int test2() {
int test2(void) {
a: goto a;
}
int test3() {
int test3(void) {
goto a;
a: ;
} // expected-warning {{non-void function does not return a value}}
void halt() {
void halt(void) {
a: goto a;
}
void halt2() __attribute__((noreturn));
void halt2(void) __attribute__((noreturn));
int test4() {
int test4(void) {
halt2();
}
int test5() {
int test5(void) {
halt2(), (void)1;
}
int test6() {
int test6(void) {
1, halt2();
}
int j;
int unknown_nohalt() {
int unknown_nohalt(void) {
return j;
}
int test7() {
int test7(void) {
unknown();
} // expected-warning {{non-void function does not return a value}}
int test8() {
int test8(void) {
(void)(1 + unknown());
} // expected-warning {{non-void function does not return a value}}
int halt3() __attribute__((noreturn));
int halt3(void) __attribute__((noreturn));
int test9() {
int test9(void) {
(void)(halt3() + unknown());
}
int test10() {
int test10(void) {
(void)(unknown() || halt3());
} // expected-warning {{non-void function does not return a value in all control paths}}
int test11() {
int test11(void) {
(void)(unknown() && halt3());
} // expected-warning {{non-void function does not return a value in all control paths}}
int test12() {
int test12(void) {
(void)(halt3() || unknown());
}
int test13() {
int test13(void) {
(void)(halt3() && unknown());
}
int test14() {
int test14(void) {
(void)(1 || unknown());
} // expected-warning {{non-void function does not return a value}}
int test15() {
int test15(void) {
(void)(0 || unknown());
} // expected-warning {{non-void function does not return a value}}
int test16() {
int test16(void) {
(void)(0 && unknown());
} // expected-warning {{non-void function does not return a value}}
int test17() {
int test17(void) {
(void)(1 && unknown());
} // expected-warning {{non-void function does not return a value}}
int test18() {
int test18(void) {
(void)(unknown_nohalt() && halt3());
} // expected-warning {{non-void function does not return a value in all control paths}}
int test19() {
int test19(void) {
(void)(unknown_nohalt() && unknown());
} // expected-warning {{non-void function does not return a value}}
int test20() {
int test20(void) {
int i;
if (i)
return 0;
@ -114,7 +114,7 @@ int test20() {
return 2;
} // expected-warning {{non-void function does not return a value in all control paths}}
int test21() {
int test21(void) {
int i;
if (i)
return 0;
@ -122,12 +122,12 @@ int test21() {
return 2;
}
int test22() {
int test22(void) {
int i;
switch (i) default: ;
} // expected-warning {{non-void function does not return a value}}
int test23() {
int test23(void) {
int i;
switch (i) {
case 0:
@ -137,7 +137,7 @@ int test23() {
}
} // expected-warning {{non-void function does not return a value in all control paths}}
int test24() {
int test24(void) {
int i;
switch (i) {
case 0:
@ -149,17 +149,17 @@ int test24() {
}
}
int test25() {
int test25(void) {
1 ? halt3() : unknown();
}
int test26() {
int test26(void) {
0 ? halt3() : unknown();
} // expected-warning {{non-void function does not return a value}}
int j;
void (*fptr)() __attribute__((noreturn));
int test27() {
void (*fptr)(void) __attribute__((noreturn));
int test27(void) {
switch (j) {
case 1:
do { } while (1);
@ -193,7 +193,7 @@ void test28() __attribute__((noreturn));
void test28(x) { while (1) { } }
void exit(int);
int test29() {
int test29(void) {
exit(1);
}
@ -205,7 +205,7 @@ extern void _longjmp (struct __jmp_buf_tag __env[1], int __val) __attribute__ ((
jmp_buf test30_j;
int test30() {
int test30(void) {
if (j)
longjmp(test30_j, 1);
else
@ -219,21 +219,21 @@ int test30() {
typedef void test31_t(int status);
void test31(test31_t *callback __attribute__((noreturn)));
void test32() {
void test32(void) {
^ (void) { while (1) { } }();
^ (void) { if (j) while (1) { } }();
while (1) { }
}
void test33() {
void test33(void) {
if (j) while (1) { }
}
// Test that 'static inline' functions are only analyzed for CFG-based warnings
// when they are used.
static inline int si_has_missing_return() {} // expected-warning{{non-void function does not return a value}}
static inline int si_has_missing_return_2() {}; // expected-warning{{non-void function does not return a value}}
static inline int si_forward();
static inline int si_has_missing_return(void) {} // expected-warning{{non-void function does not return a value}}
static inline int si_has_missing_return_2(void) {}; // expected-warning{{non-void function does not return a value}}
static inline int si_forward(void);
static inline int si_has_missing_return_3(int x) {
if (x)
return si_has_missing_return_3(x+1);
@ -243,17 +243,17 @@ int test_static_inline(int x) {
si_forward();
return x ? si_has_missing_return_2() : si_has_missing_return_3(x);
}
static inline int si_forward() {} // expected-warning{{non-void function does not return a value}}
static inline int si_forward(void) {} // expected-warning{{non-void function does not return a value}}
// Test warnings on ignored qualifiers on return types.
const int ignored_c_quals(); // expected-warning{{'const' type qualifier on return type has no effect}}
const volatile int ignored_cv_quals(); // expected-warning{{'const volatile' type qualifiers on return type have no effect}}
char* const volatile restrict ignored_cvr_quals(); // expected-warning{{'const volatile restrict' type qualifiers on return type have no effect}}
const int ignored_c_quals(void); // expected-warning{{'const' type qualifier on return type has no effect}}
const volatile int ignored_cv_quals(void); // expected-warning{{'const volatile' type qualifiers on return type have no effect}}
char* const volatile restrict ignored_cvr_quals(void); // expected-warning{{'const volatile restrict' type qualifiers on return type have no effect}}
typedef const int CI;
CI ignored_quals_typedef();
CI ignored_quals_typedef(void);
const CI ignored_quals_typedef_2(); // expected-warning{{'const' type qualifier}}
const CI ignored_quals_typedef_2(void); // expected-warning{{'const' type qualifier}}
// Test that for switch(enum) that if the switch statement covers all the cases
// that we don't consider that for -Wreturn-type.
@ -277,7 +277,7 @@ int test34(int x) {
}
// PR18999
int test35() {
int test35(void) {
lbl:
if (1)
goto lbl;
@ -322,14 +322,14 @@ int PR19074_positive(int x) {
} // expected-warning {{non-void function does not return a value in all control paths}}
// sizeof(long) test.
int sizeof_long() {
int sizeof_long(void) {
if (sizeof(long) == 4)
return 1;
if (sizeof(long) == 8)
return 2;
} // no-warning
int return_statement_expression() {
int return_statement_expression(void) {
if (unknown())
return ({
while (0)

View File

@ -1,7 +1,7 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
// RUN: not %clang_cc1 -fsyntax-only %s -fdiagnostics-parseable-fixits 2>&1 | \
// RUN: %clang_cc1 -fsyntax-only -verify -Wno-strict-prototypes %s
// RUN: not %clang_cc1 -fsyntax-only -Wno-strict-prototypes %s -fdiagnostics-parseable-fixits 2>&1 | \
// RUN: FileCheck %s --check-prefix=C
// RUN: not %clang_cc1 -fsyntax-only %s -fdiagnostics-parseable-fixits -x c++ -std=c++11 2>&1 | \
// RUN: not %clang_cc1 -fsyntax-only -Wno-strict-prototypes %s -fdiagnostics-parseable-fixits -x c++ -std=c++11 2>&1 | \
// RUN: FileCheck %s --check-prefix=CXX11
int x __attribute__((sentinel)); //expected-warning{{'sentinel' attribute only applies to functions, methods and blocks}}
@ -18,7 +18,7 @@ void f5(int a) __attribute__ ((sentinel)); //expected-warning{{'sentinel' attrib
void f6() __attribute__((__sentinel__)); // expected-warning {{'sentinel' attribute requires named arguments}}
void g() {
void g(void) {
// The integer literal zero is not a sentinel.
f1(1, 0); // expected-warning {{missing sentinel in function call}}
// C: fix-it:{{.*}}:{23:10-23:10}:", (void*) 0"

View File

@ -1,6 +1,6 @@
// RUN: %clang_cc1 -fsyntax-only -verify -Wall -W -Wno-comment -triple arm64-linux-gnu -target-feature +sve -std=c90 %s
// RUN: %clang_cc1 -fsyntax-only -verify -Wall -W -triple arm64-linux-gnu -target-feature +sve -std=c11 %s
// RUN: %clang_cc1 -fsyntax-only -verify -Wall -W -triple arm64-linux-gnu -target-feature +sve -std=gnu11 %s
// RUN: %clang_cc1 -fsyntax-only -verify -Wall -W -Wno-comment -Wno-strict-prototypes -triple arm64-linux-gnu -target-feature +sve -std=c90 %s
// RUN: %clang_cc1 -fsyntax-only -verify -Wall -W -Wno-strict-prototypes -triple arm64-linux-gnu -target-feature +sve -std=c11 %s
// RUN: %clang_cc1 -fsyntax-only -verify -Wall -W -Wno-strict-prototypes -triple arm64-linux-gnu -target-feature +sve -std=gnu11 %s
typedef __SVInt8_t svint8_t;
typedef __SVInt16_t svint16_t;
@ -26,7 +26,7 @@ int alignof_int8_var_ptr = _Alignof(extern_int8_ptr); // expected-warning {{GNU
void pass_int8(svint8_t); // expected-note {{passing argument to parameter here}}
svint8_t return_int8();
svint8_t return_int8(void);
typedef svint8_t vec_int8_a __attribute__((vector_size(64))); // expected-error {{invalid vector element type}}
typedef svint8_t vec_int8_b __attribute__((ext_vector_type(4))); // expected-error {{invalid vector element type}}
@ -45,7 +45,7 @@ void __attribute__((overloadable)) overf16(int); // expected-note + {{not
void noproto();
void varargs(int, ...);
void unused() {
void unused(void) {
svint8_t unused_int8; // expected-warning {{unused}}
}

View File

@ -1,4 +1,4 @@
// RUN: %clang_cc1 -triple x86_64-apple-macosx10.14.0 -fsyntax-only -fblocks -pedantic -verify %s
// RUN: %clang_cc1 -triple x86_64-apple-macosx10.14.0 -fsyntax-only -fblocks -pedantic -Wno-strict-prototypes -verify %s
void cat0(int a[static 0]) {} // expected-warning {{zero size arrays are an extension}} \
// expected-note {{callee declares array parameter as static here}}

View File

@ -1,4 +1,4 @@
// RUN: %clang_cc1 -fsyntax-only -verify -triple x86_64-pc-linux-gnu %s
// RUN: %clang_cc1 -fsyntax-only -Wno-strict-prototypes -verify -triple x86_64-pc-linux-gnu %s
// CC qualifier can be applied only to functions
int __attribute__((stdcall)) var1; // expected-warning{{'stdcall' only applies to function types; type here is 'int'}}

View File

@ -1,4 +1,4 @@
// RUN: %clang_cc1 -fsyntax-only -verify -triple i686-apple-darwin10 %s
// RUN: %clang_cc1 -fsyntax-only -Wno-strict-prototypes -verify -triple i686-apple-darwin10 %s
// CC qualifier can be applied only to functions
int __attribute__((stdcall)) var1; // expected-warning{{'stdcall' only applies to function types; type here is 'int'}}

View File

@ -1,4 +1,4 @@
// RUN: %clang_cc1 -fsyntax-only -pedantic -verify %s
// RUN: %clang_cc1 -fsyntax-only -pedantic -Wno-strict-prototypes -verify %s
/* This test checks the introduction of struct and union types based
on a type specifier of the form "struct-or-union identifier" when they
@ -41,7 +41,7 @@ struct S6 {
enum { BAR } e;
};
void test_S6() {
void test_S6(void) {
struct S6 a;
a.e = BAR;
}

View File

@ -1,4 +1,4 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s -Wno-unreachable-code
// RUN: %clang_cc1 -fsyntax-only -verify %s -Wno-unreachable-code -Wno-strict-prototypes
int foo(int X, int Y);

View File

@ -1,4 +1,4 @@
// RUN: %clang_cc1 -fsyntax-only -fblocks -fobjc-arc -verify -Wno-objc-root-class %s
// RUN: %clang_cc1 -fsyntax-only -fblocks -fobjc-arc -verify -Wno-objc-root-class -Wno-strict-prototypes %s
// rdar://8843524

View File

@ -1,4 +1,4 @@
// RUN: %clang_cc1 -verify -fsyntax-only -fobjc-arc -fblocks %s
// RUN: %clang_cc1 -verify -fsyntax-only -fobjc-arc -fblocks -Wno-strict-prototypes %s
#define SWIFT_NAME(name) __attribute__((__swift_name__(name)))
#define SWIFT_ASYNC_NAME(name) __attribute__((__swift_async_name__(name)))

View File

@ -1,4 +1,4 @@
// RUN: %clang_cc1 -triple %itanium_abi_triple -fsyntax-only -verify -fblocks %s
// RUN: %clang_cc1 -triple %itanium_abi_triple -fsyntax-only -verify -fblocks -Wno-strict-prototypes %s
#define bool _Bool
@protocol NSObject;

View File

@ -76,7 +76,7 @@ typedef signed char BOOL;
#define PAIR(x) @#x, [NSNumber numberWithInt:(x)]
#define TWO(x) ((x), (x))
void foo() {
void foo(void) {
NSString *str = M(@"foo"); // expected-warning {{redundant}}
str = @"foo"; // expected-warning {{redundant}}
NSArray *arr = @[str]; // expected-warning {{redundant}}

View File

@ -1,4 +1,4 @@
// RUN: %clang_cc1 -fsyntax-only -Werror -verify -Wno-objc-root-class %s
// RUN: %clang_cc1 -fsyntax-only -Werror -verify -Wno-objc-root-class -Wno-strict-prototypes %s
// expected-no-diagnostics
// rdar://10387088

View File

@ -1,4 +1,4 @@
// RUN: %clang_cc1 -triple x86_64-apple-macosx10.13.0 -fobjc-runtime=macosx-10.13.0 -fblocks -fobjc-arc %s -verify
// RUN: %clang_cc1 -triple x86_64-apple-macosx10.13.0 -fobjc-runtime=macosx-10.13.0 -fblocks -fobjc-arc -Wno-strict-prototypes %s -verify
// RUN: %clang_cc1 -triple x86_64-apple-macosx10.13.0 -fobjc-runtime=macosx-10.13.0 -fblocks -fobjc-arc -xobjective-c++ %s -verify
#define EXT_RET __attribute__((objc_externally_retained))

View File

@ -1,4 +1,4 @@
// RUN: %clang_cc1 -fsyntax-only -verify -Wno-pointer-to-int-cast -Wno-objc-root-class %s
// RUN: %clang_cc1 -fsyntax-only -verify -Wno-pointer-to-int-cast -Wno-objc-root-class -Wno-strict-prototypes %s
// rdar://5986251
@protocol SomeProtocol

View File

@ -1,6 +1,6 @@
// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL2.0
// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL3.0 -cl-ext=+__opencl_c_pipes,+__opencl_c_generic_address_space,+__opencl_c_program_scope_global_variables
// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL3.0 -cl-ext=+__opencl_c_pipes,+__opencl_c_generic_address_space,-__opencl_c_program_scope_global_variables,-__opencl_c_device_enqueue
// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -Wno-strict-prototypes -cl-std=CL2.0
// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -Wno-strict-prototypes -cl-std=CL3.0 -cl-ext=+__opencl_c_pipes,+__opencl_c_generic_address_space,+__opencl_c_program_scope_global_variables
// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -Wno-strict-prototypes -cl-std=CL3.0 -cl-ext=+__opencl_c_pipes,+__opencl_c_generic_address_space,-__opencl_c_program_scope_global_variables,-__opencl_c_device_enqueue
// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=clc++1.0
// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=clc++2021 -cl-ext=+__opencl_c_pipes,+__opencl_c_generic_address_space,+__opencl_c_program_scope_global_variables
// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=clc++2021 -cl-ext=+__opencl_c_pipes,+__opencl_c_generic_address_space,-__opencl_c_program_scope_global_variables,-__opencl_c_device_enqueue