Aaron Ballman e9e55acd1b 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 seventh batch of tests being updated (there are a
significant number of other tests left to be updated).
2022-02-10 16:06:03 -05:00

38 lines
1.2 KiB
Objective-C

// UNSUPPORTED: -zos, -aix
// RUN: rm -rf %t
// RUN: %clang_cc1 -fmodules-cache-path=%t -fmodules -fimplicit-module-maps -I %S/Inputs %s -verify
// RUN: %clang_cc1 -fmodules-cache-path=%t -fmodules -fimplicit-module-maps -I %S/Inputs -x c %s -verify
// RUN: %clang_cc1 -fmodules-cache-path=%t -fmodules -fimplicit-module-maps -I %S/Inputs -x objective-c++ %s -verify
// RUN: rm -rf %t.pch.cache
// RUN: %clang_cc1 -fmodules-cache-path=%t.pch.cache -fmodules -fimplicit-module-maps -I %S/Inputs -emit-pch -o %t.pch -x objective-c-header %S/Inputs/use-builtin.h
// RUN: %clang_cc1 -fmodules-cache-path=%t.pch.cache -fmodules -fimplicit-module-maps -I %S/Inputs %s -include-pch %t.pch %s -verify
// expected-no-diagnostics
void use_constant_string_builtins1(void) {
(void)__builtin___CFStringMakeConstantString("");
(void)__builtin___NSStringMakeConstantString("");
}
#include "builtin.h"
int foo(void) {
return __builtin_object_size(p, 0);
}
#include "builtin_sub.h"
int bar(void) {
return __builtin_object_size(p, 0);
}
int baz(void) {
return IS_CONST(0);
}
void use_constant_string_builtins2(void) {
(void)__builtin___CFStringMakeConstantString("");
(void)__builtin___NSStringMakeConstantString("");
}