[cfe-commits] r151809 - in /cfe/trunk: docs/LanguageExtensions.html lib/Lex/PPMacroExpansion.cpp test/Preprocessor/has_attribute.c

Jonathan Sauer jonathan.sauer at gmx.de
Thu Mar 1 09:20:03 PST 2012


Hello,

> Added: cfe/trunk/test/Preprocessor/has_attribute.c
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/has_attribute.c?rev=151809&view=auto
> ==============================================================================
> --- cfe/trunk/test/Preprocessor/has_attribute.c (added)
> +++ cfe/trunk/test/Preprocessor/has_attribute.c Thu Mar  1 08:53:16 2012
> @@ -0,0 +1,14 @@
> +// RUN: %clang_cc1 %s
> +// RUN: %clang_cc1 %s -E
> +#ifndef __has_attribute
> +#error Should have __has_attribute
> +#endif
> +
> +#if __has_attribute(something_we_dont_have)
> +#error Bad
> +#endif
> +
> +#if !__has_attribute(__always_inline__) || \
> +    !__has_attribute(always_inline)
> +#error Clang should have this
> +#endif

From my attempt at extending the __has_attribute check ;-) I discovered that there already is a test
for __has_attribute, albeit in test/Lexer/has_attribute.cpp. Attached is a patch that merges both into
the new test, as __has_attribute is handled in the preprocessor, not the lexer (I also took the liberty
of adapting the test to clang's test framework).


Jonathan

-------------- next part --------------
A non-text attachment was scrubbed...
Name: attributes.diff
Type: application/octet-stream
Size: 1552 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120301/bb60d861/attachment.obj>
-------------- next part --------------




More information about the cfe-commits mailing list