Files
clang-p2996/clang/test/Sema/attr-print.c
Aaron Ballman 5824d2bb0f Fix the declaration printer to properly handle prototypes in C
Previously, we would take a declaration like void f(void) and print it
as void f(). That's correct in C++ as far as it goes, but is incorrect
in C because that converts the function from having a prototype to one
which does not.

This turns out to matter for some of our tests that use the pretty
printer where we'd like to get rid of the K&R prototypes from the test
but can't because the test is checking the pretty printed function
signature, as done with the ARCMT tests.
2022-02-17 13:54:09 -05:00

39 lines
1.0 KiB
C

// RUN: %clang_cc1 %s -ast-print -fms-extensions | FileCheck %s
// CHECK: int x __attribute__((aligned(4)));
int x __attribute__((aligned(4)));
// FIXME: Print this at a valid location for a __declspec attr.
// CHECK: int y __declspec(align(4));
__declspec(align(4)) int y;
// CHECK: short arr[3] __attribute__((aligned));
short arr[3] __attribute__((aligned));
// CHECK: void foo(void) __attribute__((const));
void foo(void) __attribute__((const));
// CHECK: void bar(void) __attribute__((__const));
void bar(void) __attribute__((__const));
// CHECK: int * __ptr32 p32;
int * __ptr32 p32;
// CHECK: int * __ptr64 p64;
int * __ptr64 p64;
// CHECK: int * __uptr __ptr32 p32_2;
int * __uptr __ptr32 p32_2;
// CHECK: int * __sptr __ptr64 p64_2;
int * __sptr __ptr64 p64_2;
// CHECK: int * __uptr __ptr32 p32_3;
int * __uptr __ptr32 p32_3;
// CHECK: int * __sptr * __ptr32 ppsp32;
int * __sptr * __ptr32 ppsp32;
// CHECK: __attribute__((availability(macos, strict, introduced=10.6)));
void f6(int) __attribute__((availability(macosx,strict,introduced=10.6)));