Aaron Ballman 7de7161304 Use functions with prototypes when appropriate; NFC
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 sixth batch of tests being updated (there are a significant
number of other tests left to be updated).
2022-02-09 17:16:10 -05:00

28 lines
1.2 KiB
C

// REQUIRES: x86-registered-target
// RUN: %clang -cc1 -fvisibility default -DSTORAGE="extern" -o - -emit-interface-stubs -std=c99 -xc %s | \
// RUN: FileCheck -check-prefix=CHECK-EXTERN %s
// RUN: %clang -cc1 -triple x86_64 -fvisibility default -DSTORAGE=extern -O0 -o - -emit-obj -std=c99 \
// RUN: %s | llvm-nm - 2>&1 | FileCheck -check-prefix=CHECK-EXTERN %s
// RUN: %clang -cc1 -fvisibility default -DSTORAGE="extern" -o - -emit-interface-stubs -std=c99 -xc %s | \
// RUN: FileCheck -check-prefix=CHECK-EXTERN2 %s
// RUN: %clang -cc1 -triple x86_64 -fvisibility default -DSTORAGE=extern -O0 -o - -emit-obj -std=c99 \
// RUN: %s | llvm-nm - 2>&1 | FileCheck -check-prefix=CHECK-EXTERN2 %s
// RUN: %clang -cc1 -fvisibility default -DSTORAGE="static" -o - -emit-interface-stubs -std=c99 -xc %s | \
// RUN: FileCheck -check-prefix=CHECK-STATIC %s
// RUN: %clang -cc1 -triple x86_64 -fvisibility default -DSTORAGE=static -O0 -o - -emit-obj -std=c99 \
// RUN: %s | llvm-nm - 2>&1 | count 0
// CHECK-EXTERN-NOT: foo
// CHECK-STATIC-NOT: foo
// CHECK-STATIC-NOT: bar
// We want to emit extern function symbols.
// CHECK-EXTERN2: bar
STORAGE int foo;
STORAGE int bar(void) { return 42; }