mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-27 04:56:07 +00:00

Introduce `nonblocking` and `nonallocating` attributes. RFC is here: https://discourse.llvm.org/t/rfc-nolock-and-noalloc-attributes/76837 This PR introduces the attributes, with some changes in Sema to deal with them as extensions to function (proto)types. There are some basic type checks, most importantly, a warning when trying to spoof the attribute (implicitly convert a function without the attribute to one that has it). A second, follow-on pull request will introduce new caller/callee verification. --------- Co-authored-by: Doug Wyatt <dwyatt@apple.com> Co-authored-by: Shafik Yaghmour <shafik.yaghmour@intel.com> Co-authored-by: Aaron Ballman <aaron@aaronballman.com> Co-authored-by: Sirraide <aeternalmail@gmail.com>
15 lines
494 B
C
15 lines
494 B
C
// RUN: %clang_cc1 -fsyntax-only -verify -std=c89 %s
|
|
|
|
// Tests for a few cases involving C functions without prototypes.
|
|
|
|
void noproto() __attribute__((nonblocking)) // expected-error {{'nonblocking' function must have a prototype}}
|
|
{
|
|
}
|
|
|
|
// This will succeed
|
|
void noproto(void) __attribute__((blocking));
|
|
|
|
// A redeclaration isn't any different - a prototype is required.
|
|
void f1(void);
|
|
void f1() __attribute__((nonblocking)); // expected-error {{'nonblocking' function must have a prototype}}
|