mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-27 17:36:05 +00:00

A significant number of our tests in C accidentally use functions without prototypes. This patch converts the function signatures to have a prototype for the situations where the test is not specific to K&R C declarations. e.g., void func(); becomes void func(void); This is the third batch of tests being updated (there are a significant number of other tests left to be updated).
27 lines
836 B
C
27 lines
836 B
C
/* RUN: %clang_cc1 -fsyntax-only %s -verify
|
|
*/
|
|
|
|
typedef void Void;
|
|
|
|
void foo(void) {
|
|
int X;
|
|
|
|
X = sizeof(int (void a)); // expected-error {{argument may not have 'void' type}}
|
|
X = sizeof(int (int, void)); // expected-error {{must be the first and only parameter}}
|
|
X = sizeof(int (void, ...)); // expected-error {{must be the first and only parameter}}
|
|
|
|
X = sizeof(int (Void a)); // expected-error {{argument may not have 'void' type}}
|
|
X = sizeof(int (int, Void)); // expected-error {{must be the first and only parameter}}
|
|
X = sizeof(int (Void, ...)); // expected-error {{must be the first and only parameter}}
|
|
|
|
// Accept these.
|
|
X = sizeof(int (void));
|
|
X = sizeof(int (Void));
|
|
}
|
|
|
|
// this is ok.
|
|
void bar(Void) {
|
|
}
|
|
|
|
void f(const void); // expected-error {{parameter must not have type qualifiers}}
|