Clang Project

clang_source_code/test/Sema/attr-mig.c
1// RUN: %clang_cc1 -fsyntax-only -verify %s
2
3typedef int kern_return_t;
4#define KERN_SUCCESS 0
5
6__attribute__((mig_server_routine)) kern_return_t var = KERN_SUCCESS; // expected-warning{{'mig_server_routine' attribute only applies to functions, Objective-C methods, and blocks}}
7
8__attribute__((mig_server_routine)) void foo_void(); // expected-warning{{'mig_server_routine' attribute only applies to routines that return a kern_return_t}}
9__attribute__((mig_server_routine)) int foo_int(); // expected-warning{{'mig_server_routine' attribute only applies to routines that return a kern_return_t}}
10
11__attribute__((mig_server_routine)) kern_return_t bar_extern(); // no-warning
12__attribute__((mig_server_routine)) kern_return_t bar_forward(); // no-warning
13
14__attribute__((mig_server_routine)) kern_return_t bar_definition() { // no-warning
15  return KERN_SUCCESS;
16}
17
18kern_return_t bar_forward() { // no-warning
19  return KERN_SUCCESS;
20}
21
22__attribute__((mig_server_routine(123))) kern_return_t bar_with_argument(); // expected-error{{'mig_server_routine' attribute takes no arguments}}
23