From 222e2a7620e6520ffaf4fc4e69d79c18da31542e Mon Sep 17 00:00:00 2001 From: "Zancanaro; Carlo" Date: Mon, 24 Sep 2012 09:58:17 +1000 Subject: Add the clang library to the repo (with some of my changes, too). --- .../TestFramework.framework/.system_framework | 0 .../Headers/AnotherTestFramework.h | 3 + .../Headers/TestFramework.h | 6 + clang/test/Preprocessor/_Pragma-dependency.c | 7 + clang/test/Preprocessor/_Pragma-dependency2.c | 5 + clang/test/Preprocessor/_Pragma-in-macro-arg.c | 35 + clang/test/Preprocessor/_Pragma-location.c | 4 + clang/test/Preprocessor/_Pragma-physloc.c | 6 + clang/test/Preprocessor/_Pragma.c | 10 + clang/test/Preprocessor/assembler-with-cpp.c | 79 + clang/test/Preprocessor/builtin_line.c | 13 + clang/test/Preprocessor/c90.c | 10 + clang/test/Preprocessor/c99-6_10_3_3_p4.c | 10 + clang/test/Preprocessor/c99-6_10_3_4_p5.c | 28 + clang/test/Preprocessor/c99-6_10_3_4_p6.c | 27 + clang/test/Preprocessor/c99-6_10_3_4_p7.c | 10 + clang/test/Preprocessor/c99-6_10_3_4_p9.c | 20 + clang/test/Preprocessor/clang_headers.c | 3 + clang/test/Preprocessor/comment_save.c | 8 + clang/test/Preprocessor/comment_save_if.c | 11 + clang/test/Preprocessor/comment_save_macro.c | 13 + clang/test/Preprocessor/cxx_and.cpp | 17 + clang/test/Preprocessor/cxx_bitand.cpp | 16 + clang/test/Preprocessor/cxx_bitor.cpp | 18 + clang/test/Preprocessor/cxx_compl.cpp | 16 + clang/test/Preprocessor/cxx_not.cpp | 15 + clang/test/Preprocessor/cxx_not_eq.cpp | 16 + clang/test/Preprocessor/cxx_oper_keyword.cpp | 7 + .../Preprocessor/cxx_oper_keyword_ms_compat.cpp | 179 ++ clang/test/Preprocessor/cxx_oper_spelling.cpp | 11 + clang/test/Preprocessor/cxx_or.cpp | 17 + clang/test/Preprocessor/cxx_true.cpp | 13 + clang/test/Preprocessor/cxx_xor.cpp | 18 + clang/test/Preprocessor/dependencies-and-pp.c | 31 + clang/test/Preprocessor/directive-invalid.c | 7 + clang/test/Preprocessor/disabled-cond-diags.c | 10 + clang/test/Preprocessor/dump-macros-spacing.c | 13 + clang/test/Preprocessor/dump-macros-undef.c | 8 + clang/test/Preprocessor/dump-options.c | 3 + clang/test/Preprocessor/dump_macros.c | 38 + clang/test/Preprocessor/dumptokens_phyloc.c | 5 + clang/test/Preprocessor/expr_comma.c | 10 + clang/test/Preprocessor/expr_define_expansion.c | 5 + clang/test/Preprocessor/expr_invalid_tok.c | 15 + clang/test/Preprocessor/expr_liveness.c | 52 + clang/test/Preprocessor/expr_multichar.c | 5 + clang/test/Preprocessor/expr_usual_conversions.c | 14 + clang/test/Preprocessor/extension-warning.c | 18 + clang/test/Preprocessor/feature_tests.c | 34 + clang/test/Preprocessor/file_to_include.h | 3 + clang/test/Preprocessor/function_macro_file.c | 5 + clang/test/Preprocessor/function_macro_file.h | 3 + clang/test/Preprocessor/has_attribute.c | 26 + clang/test/Preprocessor/has_include.c | 83 + clang/test/Preprocessor/hash_line.c | 8 + clang/test/Preprocessor/hash_space.c | 6 + clang/test/Preprocessor/header_lookup1.c | 2 + clang/test/Preprocessor/if_warning.c | 31 + clang/test/Preprocessor/ifdef-recover.c | 15 + clang/test/Preprocessor/import_self.c | 7 + clang/test/Preprocessor/include-directive1.c | 14 + clang/test/Preprocessor/include-directive2.c | 17 + clang/test/Preprocessor/include-directive3.c | 3 + clang/test/Preprocessor/include-macros.c | 4 + clang/test/Preprocessor/include-pth.c | 3 + clang/test/Preprocessor/indent_macro.c | 6 + clang/test/Preprocessor/init.c | 1764 ++++++++++++++++++++ clang/test/Preprocessor/line-directive-output.c | 71 + clang/test/Preprocessor/line-directive.c | 92 + clang/test/Preprocessor/macro-multiline.c | 8 + clang/test/Preprocessor/macro_arg_directive.c | 20 + clang/test/Preprocessor/macro_arg_directive.h | 9 + clang/test/Preprocessor/macro_arg_keyword.c | 6 + clang/test/Preprocessor/macro_disable.c | 43 + clang/test/Preprocessor/macro_expand.c | 19 + clang/test/Preprocessor/macro_expandloc.c | 6 + clang/test/Preprocessor/macro_expandloc2.c | 6 + clang/test/Preprocessor/macro_fn.c | 46 + clang/test/Preprocessor/macro_fn_comma_swallow.c | 28 + clang/test/Preprocessor/macro_fn_disable_expand.c | 30 + clang/test/Preprocessor/macro_fn_lparen_scan.c | 27 + clang/test/Preprocessor/macro_fn_lparen_scan2.c | 7 + clang/test/Preprocessor/macro_fn_placemarker.c | 5 + clang/test/Preprocessor/macro_fn_preexpand.c | 12 + clang/test/Preprocessor/macro_fn_varargs_iso.c | 11 + clang/test/Preprocessor/macro_fn_varargs_named.c | 10 + clang/test/Preprocessor/macro_misc.c | 23 + clang/test/Preprocessor/macro_not_define.c | 9 + clang/test/Preprocessor/macro_paste_bad.c | 34 + clang/test/Preprocessor/macro_paste_bcpl_comment.c | 5 + .../Preprocessor/macro_paste_c_block_comment.c | 5 + clang/test/Preprocessor/macro_paste_commaext.c | 13 + clang/test/Preprocessor/macro_paste_empty.c | 13 + clang/test/Preprocessor/macro_paste_hard.c | 17 + clang/test/Preprocessor/macro_paste_hashhash.c | 11 + clang/test/Preprocessor/macro_paste_msextensions.c | 34 + clang/test/Preprocessor/macro_paste_none.c | 6 + clang/test/Preprocessor/macro_paste_simple.c | 14 + clang/test/Preprocessor/macro_paste_spacing.c | 7 + clang/test/Preprocessor/macro_paste_spacing2.c | 6 + clang/test/Preprocessor/macro_rescan.c | 9 + clang/test/Preprocessor/macro_rescan2.c | 15 + clang/test/Preprocessor/macro_rescan_varargs.c | 13 + clang/test/Preprocessor/macro_rparen_scan.c | 8 + clang/test/Preprocessor/macro_rparen_scan2.c | 10 + clang/test/Preprocessor/macro_space.c | 5 + clang/test/Preprocessor/macro_undef.c | 4 + clang/test/Preprocessor/mi_opt.c | 11 + clang/test/Preprocessor/mi_opt.h | 4 + clang/test/Preprocessor/mi_opt2.c | 15 + clang/test/Preprocessor/mi_opt2.h | 5 + clang/test/Preprocessor/microsoft-import.c | 17 + clang/test/Preprocessor/missing-system-header.c | 2 + clang/test/Preprocessor/missing-system-header.h | 2 + clang/test/Preprocessor/mmx.c | 13 + clang/test/Preprocessor/non_fragile_feature.m | 12 + clang/test/Preprocessor/non_fragile_feature1.m | 8 + clang/test/Preprocessor/objc-pp.m | 4 + clang/test/Preprocessor/optimize.c | 29 + clang/test/Preprocessor/output_paste_avoid.c | 33 + clang/test/Preprocessor/overflow.c | 25 + clang/test/Preprocessor/pic.c | 34 + clang/test/Preprocessor/pp-record.c | 12 + clang/test/Preprocessor/pp-record.h | 3 + clang/test/Preprocessor/pr2086.c | 11 + clang/test/Preprocessor/pr2086.h | 6 + clang/test/Preprocessor/pragma-pushpop-macro.c | 41 + clang/test/Preprocessor/pragma_diagnostic.c | 32 + clang/test/Preprocessor/pragma_diagnostic_output.c | 26 + .../Preprocessor/pragma_diagnostic_sections.cpp | 80 + clang/test/Preprocessor/pragma_microsoft.c | 83 + clang/test/Preprocessor/pragma_poison.c | 20 + clang/test/Preprocessor/pragma_sysheader.c | 12 + clang/test/Preprocessor/pragma_sysheader.h | 4 + clang/test/Preprocessor/pragma_unknown.c | 28 + clang/test/Preprocessor/predefined-arch-macros.c | 866 ++++++++++ clang/test/Preprocessor/predefined-exceptions.m | 15 + clang/test/Preprocessor/predefined-macros.c | 15 + clang/test/Preprocessor/print_line_count.c | 4 + clang/test/Preprocessor/print_line_empty_file.c | 12 + clang/test/Preprocessor/print_line_track.c | 17 + clang/test/Preprocessor/pushable-diagnostics.c | 17 + clang/test/Preprocessor/skipping_unclean.c | 9 + clang/test/Preprocessor/stdint.c | 959 +++++++++++ clang/test/Preprocessor/stringize_misc.c | 30 + clang/test/Preprocessor/stringize_space.c | 4 + clang/test/Preprocessor/stringize_space2.c | 6 + clang/test/Preprocessor/traditional-cpp.c | 12 + clang/test/Preprocessor/undef-error.c | 5 + clang/test/Preprocessor/unterminated.c | 5 + .../Preprocessor/user_defined_system_framework.c | 8 + .../Preprocessor/warn-disabled-macro-expansion.c | 27 + clang/test/Preprocessor/warn-macro-unused.c | 10 + clang/test/Preprocessor/warn-macro-unused.h | 1 + clang/test/Preprocessor/warning_tests.c | 19 + clang/test/Preprocessor/x86_target_features.c | 32 + 156 files changed, 6281 insertions(+) create mode 100644 clang/test/Preprocessor/Inputs/TestFramework.framework/.system_framework create mode 100644 clang/test/Preprocessor/Inputs/TestFramework.framework/Frameworks/AnotherTestFramework.framework/Headers/AnotherTestFramework.h create mode 100644 clang/test/Preprocessor/Inputs/TestFramework.framework/Headers/TestFramework.h create mode 100644 clang/test/Preprocessor/_Pragma-dependency.c create mode 100644 clang/test/Preprocessor/_Pragma-dependency2.c create mode 100644 clang/test/Preprocessor/_Pragma-in-macro-arg.c create mode 100644 clang/test/Preprocessor/_Pragma-location.c create mode 100644 clang/test/Preprocessor/_Pragma-physloc.c create mode 100644 clang/test/Preprocessor/_Pragma.c create mode 100644 clang/test/Preprocessor/assembler-with-cpp.c create mode 100644 clang/test/Preprocessor/builtin_line.c create mode 100644 clang/test/Preprocessor/c90.c create mode 100644 clang/test/Preprocessor/c99-6_10_3_3_p4.c create mode 100644 clang/test/Preprocessor/c99-6_10_3_4_p5.c create mode 100644 clang/test/Preprocessor/c99-6_10_3_4_p6.c create mode 100644 clang/test/Preprocessor/c99-6_10_3_4_p7.c create mode 100644 clang/test/Preprocessor/c99-6_10_3_4_p9.c create mode 100644 clang/test/Preprocessor/clang_headers.c create mode 100644 clang/test/Preprocessor/comment_save.c create mode 100644 clang/test/Preprocessor/comment_save_if.c create mode 100644 clang/test/Preprocessor/comment_save_macro.c create mode 100644 clang/test/Preprocessor/cxx_and.cpp create mode 100644 clang/test/Preprocessor/cxx_bitand.cpp create mode 100644 clang/test/Preprocessor/cxx_bitor.cpp create mode 100644 clang/test/Preprocessor/cxx_compl.cpp create mode 100644 clang/test/Preprocessor/cxx_not.cpp create mode 100644 clang/test/Preprocessor/cxx_not_eq.cpp create mode 100644 clang/test/Preprocessor/cxx_oper_keyword.cpp create mode 100644 clang/test/Preprocessor/cxx_oper_keyword_ms_compat.cpp create mode 100644 clang/test/Preprocessor/cxx_oper_spelling.cpp create mode 100644 clang/test/Preprocessor/cxx_or.cpp create mode 100644 clang/test/Preprocessor/cxx_true.cpp create mode 100644 clang/test/Preprocessor/cxx_xor.cpp create mode 100644 clang/test/Preprocessor/dependencies-and-pp.c create mode 100644 clang/test/Preprocessor/directive-invalid.c create mode 100644 clang/test/Preprocessor/disabled-cond-diags.c create mode 100644 clang/test/Preprocessor/dump-macros-spacing.c create mode 100644 clang/test/Preprocessor/dump-macros-undef.c create mode 100644 clang/test/Preprocessor/dump-options.c create mode 100644 clang/test/Preprocessor/dump_macros.c create mode 100644 clang/test/Preprocessor/dumptokens_phyloc.c create mode 100644 clang/test/Preprocessor/expr_comma.c create mode 100644 clang/test/Preprocessor/expr_define_expansion.c create mode 100644 clang/test/Preprocessor/expr_invalid_tok.c create mode 100644 clang/test/Preprocessor/expr_liveness.c create mode 100644 clang/test/Preprocessor/expr_multichar.c create mode 100644 clang/test/Preprocessor/expr_usual_conversions.c create mode 100644 clang/test/Preprocessor/extension-warning.c create mode 100644 clang/test/Preprocessor/feature_tests.c create mode 100644 clang/test/Preprocessor/file_to_include.h create mode 100644 clang/test/Preprocessor/function_macro_file.c create mode 100644 clang/test/Preprocessor/function_macro_file.h create mode 100644 clang/test/Preprocessor/has_attribute.c create mode 100644 clang/test/Preprocessor/has_include.c create mode 100644 clang/test/Preprocessor/hash_line.c create mode 100644 clang/test/Preprocessor/hash_space.c create mode 100644 clang/test/Preprocessor/header_lookup1.c create mode 100644 clang/test/Preprocessor/if_warning.c create mode 100644 clang/test/Preprocessor/ifdef-recover.c create mode 100644 clang/test/Preprocessor/import_self.c create mode 100644 clang/test/Preprocessor/include-directive1.c create mode 100644 clang/test/Preprocessor/include-directive2.c create mode 100644 clang/test/Preprocessor/include-directive3.c create mode 100644 clang/test/Preprocessor/include-macros.c create mode 100644 clang/test/Preprocessor/include-pth.c create mode 100644 clang/test/Preprocessor/indent_macro.c create mode 100644 clang/test/Preprocessor/init.c create mode 100644 clang/test/Preprocessor/line-directive-output.c create mode 100644 clang/test/Preprocessor/line-directive.c create mode 100644 clang/test/Preprocessor/macro-multiline.c create mode 100644 clang/test/Preprocessor/macro_arg_directive.c create mode 100644 clang/test/Preprocessor/macro_arg_directive.h create mode 100644 clang/test/Preprocessor/macro_arg_keyword.c create mode 100644 clang/test/Preprocessor/macro_disable.c create mode 100644 clang/test/Preprocessor/macro_expand.c create mode 100644 clang/test/Preprocessor/macro_expandloc.c create mode 100644 clang/test/Preprocessor/macro_expandloc2.c create mode 100644 clang/test/Preprocessor/macro_fn.c create mode 100644 clang/test/Preprocessor/macro_fn_comma_swallow.c create mode 100644 clang/test/Preprocessor/macro_fn_disable_expand.c create mode 100644 clang/test/Preprocessor/macro_fn_lparen_scan.c create mode 100644 clang/test/Preprocessor/macro_fn_lparen_scan2.c create mode 100644 clang/test/Preprocessor/macro_fn_placemarker.c create mode 100644 clang/test/Preprocessor/macro_fn_preexpand.c create mode 100644 clang/test/Preprocessor/macro_fn_varargs_iso.c create mode 100644 clang/test/Preprocessor/macro_fn_varargs_named.c create mode 100644 clang/test/Preprocessor/macro_misc.c create mode 100644 clang/test/Preprocessor/macro_not_define.c create mode 100644 clang/test/Preprocessor/macro_paste_bad.c create mode 100644 clang/test/Preprocessor/macro_paste_bcpl_comment.c create mode 100644 clang/test/Preprocessor/macro_paste_c_block_comment.c create mode 100644 clang/test/Preprocessor/macro_paste_commaext.c create mode 100644 clang/test/Preprocessor/macro_paste_empty.c create mode 100644 clang/test/Preprocessor/macro_paste_hard.c create mode 100644 clang/test/Preprocessor/macro_paste_hashhash.c create mode 100644 clang/test/Preprocessor/macro_paste_msextensions.c create mode 100644 clang/test/Preprocessor/macro_paste_none.c create mode 100644 clang/test/Preprocessor/macro_paste_simple.c create mode 100644 clang/test/Preprocessor/macro_paste_spacing.c create mode 100644 clang/test/Preprocessor/macro_paste_spacing2.c create mode 100644 clang/test/Preprocessor/macro_rescan.c create mode 100644 clang/test/Preprocessor/macro_rescan2.c create mode 100644 clang/test/Preprocessor/macro_rescan_varargs.c create mode 100644 clang/test/Preprocessor/macro_rparen_scan.c create mode 100644 clang/test/Preprocessor/macro_rparen_scan2.c create mode 100644 clang/test/Preprocessor/macro_space.c create mode 100644 clang/test/Preprocessor/macro_undef.c create mode 100644 clang/test/Preprocessor/mi_opt.c create mode 100644 clang/test/Preprocessor/mi_opt.h create mode 100644 clang/test/Preprocessor/mi_opt2.c create mode 100644 clang/test/Preprocessor/mi_opt2.h create mode 100644 clang/test/Preprocessor/microsoft-import.c create mode 100644 clang/test/Preprocessor/missing-system-header.c create mode 100644 clang/test/Preprocessor/missing-system-header.h create mode 100644 clang/test/Preprocessor/mmx.c create mode 100644 clang/test/Preprocessor/non_fragile_feature.m create mode 100644 clang/test/Preprocessor/non_fragile_feature1.m create mode 100644 clang/test/Preprocessor/objc-pp.m create mode 100644 clang/test/Preprocessor/optimize.c create mode 100644 clang/test/Preprocessor/output_paste_avoid.c create mode 100644 clang/test/Preprocessor/overflow.c create mode 100644 clang/test/Preprocessor/pic.c create mode 100644 clang/test/Preprocessor/pp-record.c create mode 100644 clang/test/Preprocessor/pp-record.h create mode 100644 clang/test/Preprocessor/pr2086.c create mode 100644 clang/test/Preprocessor/pr2086.h create mode 100644 clang/test/Preprocessor/pragma-pushpop-macro.c create mode 100644 clang/test/Preprocessor/pragma_diagnostic.c create mode 100644 clang/test/Preprocessor/pragma_diagnostic_output.c create mode 100644 clang/test/Preprocessor/pragma_diagnostic_sections.cpp create mode 100644 clang/test/Preprocessor/pragma_microsoft.c create mode 100644 clang/test/Preprocessor/pragma_poison.c create mode 100644 clang/test/Preprocessor/pragma_sysheader.c create mode 100644 clang/test/Preprocessor/pragma_sysheader.h create mode 100644 clang/test/Preprocessor/pragma_unknown.c create mode 100644 clang/test/Preprocessor/predefined-arch-macros.c create mode 100644 clang/test/Preprocessor/predefined-exceptions.m create mode 100644 clang/test/Preprocessor/predefined-macros.c create mode 100644 clang/test/Preprocessor/print_line_count.c create mode 100644 clang/test/Preprocessor/print_line_empty_file.c create mode 100644 clang/test/Preprocessor/print_line_track.c create mode 100644 clang/test/Preprocessor/pushable-diagnostics.c create mode 100644 clang/test/Preprocessor/skipping_unclean.c create mode 100644 clang/test/Preprocessor/stdint.c create mode 100644 clang/test/Preprocessor/stringize_misc.c create mode 100644 clang/test/Preprocessor/stringize_space.c create mode 100644 clang/test/Preprocessor/stringize_space2.c create mode 100644 clang/test/Preprocessor/traditional-cpp.c create mode 100644 clang/test/Preprocessor/undef-error.c create mode 100644 clang/test/Preprocessor/unterminated.c create mode 100644 clang/test/Preprocessor/user_defined_system_framework.c create mode 100644 clang/test/Preprocessor/warn-disabled-macro-expansion.c create mode 100644 clang/test/Preprocessor/warn-macro-unused.c create mode 100644 clang/test/Preprocessor/warn-macro-unused.h create mode 100644 clang/test/Preprocessor/warning_tests.c create mode 100644 clang/test/Preprocessor/x86_target_features.c (limited to 'clang/test/Preprocessor') diff --git a/clang/test/Preprocessor/Inputs/TestFramework.framework/.system_framework b/clang/test/Preprocessor/Inputs/TestFramework.framework/.system_framework new file mode 100644 index 0000000..e69de29 diff --git a/clang/test/Preprocessor/Inputs/TestFramework.framework/Frameworks/AnotherTestFramework.framework/Headers/AnotherTestFramework.h b/clang/test/Preprocessor/Inputs/TestFramework.framework/Frameworks/AnotherTestFramework.framework/Headers/AnotherTestFramework.h new file mode 100644 index 0000000..489f17a --- /dev/null +++ b/clang/test/Preprocessor/Inputs/TestFramework.framework/Frameworks/AnotherTestFramework.framework/Headers/AnotherTestFramework.h @@ -0,0 +1,3 @@ +static inline int another_test_framework_func(unsigned a) { + return a; +} diff --git a/clang/test/Preprocessor/Inputs/TestFramework.framework/Headers/TestFramework.h b/clang/test/Preprocessor/Inputs/TestFramework.framework/Headers/TestFramework.h new file mode 100644 index 0000000..06f9ab5 --- /dev/null +++ b/clang/test/Preprocessor/Inputs/TestFramework.framework/Headers/TestFramework.h @@ -0,0 +1,6 @@ +// Include a subframework header. +#include + +static inline int test_framework_func(unsigned a) { + return a; +} diff --git a/clang/test/Preprocessor/_Pragma-dependency.c b/clang/test/Preprocessor/_Pragma-dependency.c new file mode 100644 index 0000000..a2861c9 --- /dev/null +++ b/clang/test/Preprocessor/_Pragma-dependency.c @@ -0,0 +1,7 @@ +// RUN: %clang_cc1 %s -E 2>&1 | grep 'DO_PRAGMA (STR' +// RUN: %clang_cc1 %s -E 2>&1 | grep '7:3' + +#define DO_PRAGMA _Pragma +#define STR "GCC dependency \"parse.y\"") + // Test that this line is printed by caret diagnostics. + DO_PRAGMA (STR diff --git a/clang/test/Preprocessor/_Pragma-dependency2.c b/clang/test/Preprocessor/_Pragma-dependency2.c new file mode 100644 index 0000000..c178764 --- /dev/null +++ b/clang/test/Preprocessor/_Pragma-dependency2.c @@ -0,0 +1,5 @@ +// RUN: %clang_cc1 -E %s -verify + +#define DO_PRAGMA _Pragma +DO_PRAGMA ("GCC dependency \"blahblabh\"") // expected-error {{file not found}} + diff --git a/clang/test/Preprocessor/_Pragma-in-macro-arg.c b/clang/test/Preprocessor/_Pragma-in-macro-arg.c new file mode 100644 index 0000000..2877bcb --- /dev/null +++ b/clang/test/Preprocessor/_Pragma-in-macro-arg.c @@ -0,0 +1,35 @@ +// RUN: %clang_cc1 %s -verify -Wconversion + +// Don't crash (rdar://11168596) +#define A(desc) _Pragma("clang diagnostic push") _Pragma("clang diagnostic ignored \"-Wparentheses\"") _Pragma("clang diagnostic pop") +#define B(desc) A(desc) +B(_Pragma("clang diagnostic ignored \"-Wparentheses\"")) + + +#define EMPTY(x) +#define INACTIVE(x) EMPTY(x) + +#define ID(x) x +#define ACTIVE(x) ID(x) + +// This should be ignored.. +INACTIVE(_Pragma("clang diagnostic ignored \"-Wconversion\"")) + +#define IGNORE_CONV _Pragma("clang diagnostic ignored \"-Wconversion\"") _Pragma("clang diagnostic ignored \"-Wconversion\"") + +// ..as should this. +INACTIVE(IGNORE_CONV) + +#define IGNORE_POPPUSH(Pop, Push, W, D) Push W D Pop +IGNORE_POPPUSH(_Pragma("clang diagnostic pop"), _Pragma("clang diagnostic push"), + _Pragma("clang diagnostic ignored \"-Wconversion\""), int q = (double)1.0); + +int x1 = (double)1.0; // expected-warning {{implicit conversion}} + +ACTIVE(_Pragma) ("clang diagnostic ignored \"-Wconversion\"")) // expected-error {{_Pragma takes a parenthesized string literal}} \ + expected-error {{expected identifier or '('}} expected-error {{expected ')'}} expected-note {{to match this '('}} + +// This should disable the warning. +ACTIVE(IGNORE_CONV) + +int x2 = (double)1.0; diff --git a/clang/test/Preprocessor/_Pragma-location.c b/clang/test/Preprocessor/_Pragma-location.c new file mode 100644 index 0000000..8b68d6c --- /dev/null +++ b/clang/test/Preprocessor/_Pragma-location.c @@ -0,0 +1,4 @@ +// RUN: %clang_cc1 %s -E | not grep 'scratch space' + +#define push _Pragma ("pack(push)") +push diff --git a/clang/test/Preprocessor/_Pragma-physloc.c b/clang/test/Preprocessor/_Pragma-physloc.c new file mode 100644 index 0000000..a093af2 --- /dev/null +++ b/clang/test/Preprocessor/_Pragma-physloc.c @@ -0,0 +1,6 @@ +// RUN: %clang_cc1 %s -E | grep '#pragma x y z' +// RUN: %clang_cc1 %s -E | grep '#pragma a b c' + +_Pragma("x y z") +_Pragma("a b c") + diff --git a/clang/test/Preprocessor/_Pragma.c b/clang/test/Preprocessor/_Pragma.c new file mode 100644 index 0000000..0a83b14 --- /dev/null +++ b/clang/test/Preprocessor/_Pragma.c @@ -0,0 +1,10 @@ +// RUN: %clang_cc1 %s -verify -Wall + +_Pragma ("GCC system_header") // expected-warning {{system_header ignored in main file}} + +// rdar://6880630 +_Pragma("#define macro") // expected-warning {{unknown pragma ignored}} + +#ifdef macro +#error #define invalid +#endif diff --git a/clang/test/Preprocessor/assembler-with-cpp.c b/clang/test/Preprocessor/assembler-with-cpp.c new file mode 100644 index 0000000..a9c4294 --- /dev/null +++ b/clang/test/Preprocessor/assembler-with-cpp.c @@ -0,0 +1,79 @@ +// RUN: %clang_cc1 -x assembler-with-cpp -E %s -o - | FileCheck -strict-whitespace -check-prefix=CHECK-Identifiers-False %s + +#ifndef __ASSEMBLER__ +#error "__ASSEMBLER__ not defined" +#endif + + +// Invalid token pasting is ok. +#define A X ## . +1: A +// CHECK-Identifiers-False: 1: X . + +// Line markers are not linemarkers in .S files, they are passed through. +# 321 +// CHECK-Identifiers-False: # 321 + +// Unknown directives are passed through. +# B C +// CHECK-Identifiers-False: # B C + +// Unknown directives are expanded. +#define D(x) BAR ## x +# D(42) +// CHECK-Identifiers-False: # BAR42 + +// Unmatched quotes are permitted. +2: ' +3: " +// CHECK-Identifiers-False: 2: ' +// CHECK-Identifiers-False: 3: " + +// (balance quotes to keep editors happy): "' + +// Empty char literals are ok. +4: '' +// CHECK-Identifiers-False: 4: '' + + +// Portions of invalid pasting should still expand as macros. +// rdar://6709206 +#define M4 expanded +#define M5() M4 ## ( + +5: M5() +// CHECK-Identifiers-False: 5: expanded ( + +// rdar://6804322 +#define FOO(name) name ## $foo +6: FOO(blarg) +// CHECK-Identifiers-False: 6: blarg $foo + +// RUN: %clang_cc1 -x assembler-with-cpp -fdollars-in-identifiers -E %s -o - | FileCheck -check-prefix=CHECK-Identifiers-True -strict-whitespace %s +#define FOO(name) name ## $foo +7: FOO(blarg) +// CHECK-Identifiers-True: 7: blarg$foo + +// +#define T6() T6 #nostring +#define T7(x) T7 #x +8: T6() +9: T7(foo) +// CHECK-Identifiers-True: 8: T6 #nostring +// CHECK-Identifiers-True: 9: T7 "foo" + +// Concatenation with period doesn't leave a space +#define T8(A,B) A ## B +10: T8(.,T8) +// CHECK-Identifiers-True: 10: .T8 + +// This should not crash. +#define T11(a) #0 +11: T11(b) +// CHECK-Identifiers-True: 11: #0 + + +// This should not crash +// rdar://8823139 +# ## +// CHECK-Identifiers-False: # ## diff --git a/clang/test/Preprocessor/builtin_line.c b/clang/test/Preprocessor/builtin_line.c new file mode 100644 index 0000000..52228b5 --- /dev/null +++ b/clang/test/Preprocessor/builtin_line.c @@ -0,0 +1,13 @@ +// RUN: %clang_cc1 %s -E | grep "^ 4" +#define FOO __LINE__ + + FOO + +// PR3579 - This should expand to the __LINE__ of the ')' not of the X. +// RUN: %clang_cc1 %s -E | grep "^A 13" + +#define X() __LINE__ + +A X( + +) diff --git a/clang/test/Preprocessor/c90.c b/clang/test/Preprocessor/c90.c new file mode 100644 index 0000000..1d5010d --- /dev/null +++ b/clang/test/Preprocessor/c90.c @@ -0,0 +1,10 @@ +/* RUN: %clang_cc1 %s -std=c89 -Eonly -verify -pedantic-errors + */ + +/* PR3919 */ + +#define foo`bar /* expected-error {{whitespace required after macro name}} */ +#define foo2!bar /* expected-warning {{whitespace recommended after macro name}} */ + +#define foo3$bar /* expected-error {{'$' in identifier}} */ + diff --git a/clang/test/Preprocessor/c99-6_10_3_3_p4.c b/clang/test/Preprocessor/c99-6_10_3_3_p4.c new file mode 100644 index 0000000..320e6cf --- /dev/null +++ b/clang/test/Preprocessor/c99-6_10_3_3_p4.c @@ -0,0 +1,10 @@ +// RUN: %clang_cc1 -E %s | FileCheck -strict-whitespace %s + +#define hash_hash # ## # +#define mkstr(a) # a +#define in_between(a) mkstr(a) +#define join(c, d) in_between(c hash_hash d) +char p[] = join(x, y); + +// CHECK: char p[] = "x ## y"; + diff --git a/clang/test/Preprocessor/c99-6_10_3_4_p5.c b/clang/test/Preprocessor/c99-6_10_3_4_p5.c new file mode 100644 index 0000000..6dea09d --- /dev/null +++ b/clang/test/Preprocessor/c99-6_10_3_4_p5.c @@ -0,0 +1,28 @@ +// Example from C99 6.10.3.4p5 +// RUN: %clang_cc1 -E %s | FileCheck -strict-whitespace %s + +#define x 3 +#define f(a) f(x * (a)) +#undef x +#define x 2 +#define g f +#define z z[0] +#define h g(~ +#define m(a) a(w) +#define w 0,1 +#define t(a) a +#define p() int +#define q(x) x +#define r(x,y) x ## y +#define str(x) # x + f(y+1) + f(f(z)) % t(t(g)(0) + t)(1); + g(x+(3,4)-w) | h 5) & m +(f)^m(m); +p() i[q()] = { q(1), r(2,3), r(4,), r(,5), r(,) }; +char c[2][6] = { str(hello), str() }; + +// CHECK: f(2 * (y+1)) + f(2 * (f(2 * (z[0])))) % f(2 * (0)) + t(1); +// CHECK: f(2 * (2 +(3,4)-0,1)) | f(2 * (~ 5)) & f(2 * (0,1))^m(0,1); +// CHECK: int i[] = { 1, 23, 4, 5, }; +// CHECK: char c[2][6] = { "hello", "" }; + diff --git a/clang/test/Preprocessor/c99-6_10_3_4_p6.c b/clang/test/Preprocessor/c99-6_10_3_4_p6.c new file mode 100644 index 0000000..98bacb2 --- /dev/null +++ b/clang/test/Preprocessor/c99-6_10_3_4_p6.c @@ -0,0 +1,27 @@ +// Example from C99 6.10.3.4p6 + +// RUN: %clang_cc1 -E %s | FileCheck -strict-whitespace %s + +#define str(s) # s +#define xstr(s) str(s) +#define debug(s, t) printf("x" # s "= %d, x" # t "= s" \ + x ## s, x ## t) +#define INCFILE(n) vers ## n +#define glue(a, b) a ## b +#define xglue(a, b) glue(a, b) +#define HIGHLOW "hello" +#define LOW LOW ", world" +debug(1, 2); +fputs(str(strncmp("abc\0d" "abc", '\4') // this goes away + == 0) str(: @\n), s); +include xstr(INCFILE(2).h) +glue(HIGH, LOW); +xglue(HIGH, LOW) + + +// CHECK: printf("x" "1" "= %d, x" "2" "= s" x1, x2); +// CHECK: fputs("strncmp(\"abc\\0d\" \"abc\", '\\4') == 0" ": @\n", s); +// CHECK: include "vers2.h" +// CHECK: "hello"; +// CHECK: "hello" ", world" + diff --git a/clang/test/Preprocessor/c99-6_10_3_4_p7.c b/clang/test/Preprocessor/c99-6_10_3_4_p7.c new file mode 100644 index 0000000..b63209b --- /dev/null +++ b/clang/test/Preprocessor/c99-6_10_3_4_p7.c @@ -0,0 +1,10 @@ +// Example from C99 6.10.3.4p7 + +// RUN: %clang_cc1 -E %s | FileCheck -strict-whitespace %s + +#define t(x,y,z) x ## y ## z +int j[] = { t(1,2,3), t(,4,5), t(6,,7), t(8,9,), +t(10,,), t(,11,), t(,,12), t(,,) }; + +// CHECK: int j[] = { 123, 45, 67, 89, +// CHECK: 10, 11, 12, }; diff --git a/clang/test/Preprocessor/c99-6_10_3_4_p9.c b/clang/test/Preprocessor/c99-6_10_3_4_p9.c new file mode 100644 index 0000000..04c4b79 --- /dev/null +++ b/clang/test/Preprocessor/c99-6_10_3_4_p9.c @@ -0,0 +1,20 @@ +// Example from C99 6.10.3.4p9 + +// RUN: %clang_cc1 -E %s | FileCheck -strict-whitespace %s + +#define debug(...) fprintf(stderr, __VA_ARGS__) +#define showlist(...) puts(#__VA_ARGS__) +#define report(test, ...) ((test)?puts(#test):\ + printf(__VA_ARGS__)) +debug("Flag"); +// CHECK: fprintf(stderr, "Flag"); + +debug("X = %d\n", x); +// CHECK: fprintf(stderr, "X = %d\n", x); + +showlist(The first, second, and third items.); +// CHECK: puts("The first, second, and third items."); + +report(x>y, "x is %d but y is %d", x, y); +// CHECK: ((x>y)?puts("x>y"): printf("x is %d but y is %d", x, y)); + diff --git a/clang/test/Preprocessor/clang_headers.c b/clang/test/Preprocessor/clang_headers.c new file mode 100644 index 0000000..41bd754 --- /dev/null +++ b/clang/test/Preprocessor/clang_headers.c @@ -0,0 +1,3 @@ +// RUN: %clang_cc1 -ffreestanding -E %s + +#include diff --git a/clang/test/Preprocessor/comment_save.c b/clang/test/Preprocessor/comment_save.c new file mode 100644 index 0000000..b860042 --- /dev/null +++ b/clang/test/Preprocessor/comment_save.c @@ -0,0 +1,8 @@ +// RUN: %clang_cc1 -E -C %s | FileCheck -strict-whitespace %s + +// foo +// CHECK: // foo + +/* bar */ +// CHECK: /* bar */ + diff --git a/clang/test/Preprocessor/comment_save_if.c b/clang/test/Preprocessor/comment_save_if.c new file mode 100644 index 0000000..4946122 --- /dev/null +++ b/clang/test/Preprocessor/comment_save_if.c @@ -0,0 +1,11 @@ +// RUN: %clang_cc1 %s -E -CC -pedantic -verify + +#if 1 /*bar */ + +#endif /*foo*/ + +#if /*foo*/ defined /*foo*/ FOO /*foo*/ +#if /*foo*/ defined /*foo*/ ( /*foo*/ FOO /*foo*/ ) /*foo*/ +#endif +#endif + diff --git a/clang/test/Preprocessor/comment_save_macro.c b/clang/test/Preprocessor/comment_save_macro.c new file mode 100644 index 0000000..6ad759f --- /dev/null +++ b/clang/test/Preprocessor/comment_save_macro.c @@ -0,0 +1,13 @@ +// RUN: %clang_cc1 -E -C %s | FileCheck -check-prefix=CHECK-C -strict-whitespace %s +// CHECK-C: boo bork bar // zot + +// RUN: %clang_cc1 -E -CC %s | FileCheck -check-prefix=CHECK-CC -strict-whitespace %s +// CHECK-CC: boo bork /* blah*/ bar // zot + +// RUN: %clang_cc1 -E %s | FileCheck -check-prefix=CHECK -strict-whitespace %s +// CHECK: boo bork bar + + +#define FOO bork // blah +boo FOO bar // zot + diff --git a/clang/test/Preprocessor/cxx_and.cpp b/clang/test/Preprocessor/cxx_and.cpp new file mode 100644 index 0000000..a84ffe7 --- /dev/null +++ b/clang/test/Preprocessor/cxx_and.cpp @@ -0,0 +1,17 @@ +// RUN: %clang_cc1 -DA -DB -E %s | grep 'int a = 37 == 37' +// RUN: %clang_cc1 -DA -E %s | grep 'int a = 927 == 927' +// RUN: %clang_cc1 -DB -E %s | grep 'int a = 927 == 927' +// RUN: %clang_cc1 -E %s | grep 'int a = 927 == 927' +#if defined(A) and defined(B) +#define X 37 +#else +#define X 927 +#endif + +#if defined(A) && defined(B) +#define Y 37 +#else +#define Y 927 +#endif + +int a = X == Y; diff --git a/clang/test/Preprocessor/cxx_bitand.cpp b/clang/test/Preprocessor/cxx_bitand.cpp new file mode 100644 index 0000000..01b4ff1 --- /dev/null +++ b/clang/test/Preprocessor/cxx_bitand.cpp @@ -0,0 +1,16 @@ +// RUN: %clang_cc1 -DA=1 -DB=2 -E %s | grep 'int a = 927 == 927' +// RUN: %clang_cc1 -DA=1 -DB=1 -E %s | grep 'int a = 37 == 37' +// RUN: %clang_cc1 -E %s | grep 'int a = 927 == 927' +#if A bitand B +#define X 37 +#else +#define X 927 +#endif + +#if A & B +#define Y 37 +#else +#define Y 927 +#endif + +int a = X == Y; diff --git a/clang/test/Preprocessor/cxx_bitor.cpp b/clang/test/Preprocessor/cxx_bitor.cpp new file mode 100644 index 0000000..c92596e --- /dev/null +++ b/clang/test/Preprocessor/cxx_bitor.cpp @@ -0,0 +1,18 @@ +// RUN: %clang_cc1 -DA=1 -DB=1 -E %s | grep 'int a = 37 == 37' +// RUN: %clang_cc1 -DA=0 -DB=1 -E %s | grep 'int a = 37 == 37' +// RUN: %clang_cc1 -DA=1 -DB=0 -E %s | grep 'int a = 37 == 37' +// RUN: %clang_cc1 -DA=0 -DB=0 -E %s | grep 'int a = 927 == 927' +// RUN: %clang_cc1 -E %s | grep 'int a = 927 == 927' +#if A bitor B +#define X 37 +#else +#define X 927 +#endif + +#if A | B +#define Y 37 +#else +#define Y 927 +#endif + +int a = X == Y; diff --git a/clang/test/Preprocessor/cxx_compl.cpp b/clang/test/Preprocessor/cxx_compl.cpp new file mode 100644 index 0000000..824092c --- /dev/null +++ b/clang/test/Preprocessor/cxx_compl.cpp @@ -0,0 +1,16 @@ +// RUN: %clang_cc1 -DA=1 -E %s | grep 'int a = 37 == 37' +// RUN: %clang_cc1 -DA=0 -E %s | grep 'int a = 927 == 927' +// RUN: %clang_cc1 -E %s | grep 'int a = 927 == 927' +#if compl 0 bitand A +#define X 37 +#else +#define X 927 +#endif + +#if ~0 & A +#define Y 37 +#else +#define Y 927 +#endif + +int a = X == Y; diff --git a/clang/test/Preprocessor/cxx_not.cpp b/clang/test/Preprocessor/cxx_not.cpp new file mode 100644 index 0000000..67e8775 --- /dev/null +++ b/clang/test/Preprocessor/cxx_not.cpp @@ -0,0 +1,15 @@ +// RUN: %clang_cc1 -DA=1 -E %s | grep 'int a = 927 == 927' +// RUN: %clang_cc1 -E %s | grep 'int a = 37 == 37' +#if not defined(A) +#define X 37 +#else +#define X 927 +#endif + +#if ! defined(A) +#define Y 37 +#else +#define Y 927 +#endif + +int a = X == Y; diff --git a/clang/test/Preprocessor/cxx_not_eq.cpp b/clang/test/Preprocessor/cxx_not_eq.cpp new file mode 100644 index 0000000..f7670fa --- /dev/null +++ b/clang/test/Preprocessor/cxx_not_eq.cpp @@ -0,0 +1,16 @@ +// RUN: %clang_cc1 -DA=1 -DB=1 -E %s | grep 'int a = 927 == 927' +// RUN: %clang_cc1 -E %s | grep 'int a = 927 == 927' +// RUN: %clang_cc1 -DA=1 -DB=2 -E %s | grep 'int a = 37 == 37' +#if A not_eq B +#define X 37 +#else +#define X 927 +#endif + +#if A != B +#define Y 37 +#else +#define Y 927 +#endif + +int a = X == Y; diff --git a/clang/test/Preprocessor/cxx_oper_keyword.cpp b/clang/test/Preprocessor/cxx_oper_keyword.cpp new file mode 100644 index 0000000..3fc246d --- /dev/null +++ b/clang/test/Preprocessor/cxx_oper_keyword.cpp @@ -0,0 +1,7 @@ +// RUN: not %clang_cc1 %s -E +// RUN: %clang_cc1 %s -E -fno-operator-names + +// Not valid in C++ unless -fno-operator-names is passed. +#define and foo + + diff --git a/clang/test/Preprocessor/cxx_oper_keyword_ms_compat.cpp b/clang/test/Preprocessor/cxx_oper_keyword_ms_compat.cpp new file mode 100644 index 0000000..1c6ef90 --- /dev/null +++ b/clang/test/Preprocessor/cxx_oper_keyword_ms_compat.cpp @@ -0,0 +1,179 @@ +// RUN: %clang_cc1 %s -E -fms-compatibility + +bool f() { + // Check that operators still work before redefining them. +#if compl 0 bitand 1 + return true and false; +#endif +} + +// All c++ keywords should be #define-able in ms mode. +// (operators like "and" aren't normally, the rest always is.) +#define and +#define and_eq +#define alignas +#define alignof +#define asm +#define auto +#define bitand +#define bitor +#define bool +#define break +#define case +#define catch +#define char +#define char16_t +#define char32_t +#define class +#define compl +#define const +#define constexpr +#define const_cast +#define continue +#define decltype +#define default +#define delete +#define double +#define dynamic_cast +#define else +#define enum +#define explicit +#define export +#define extern +#define false +#define float +#define for +#define friend +#define goto +#define if +#define inline +#define int +#define long +#define mutable +#define namespace +#define new +#define noexcept +#define not +#define not_eq +#define nullptr +#define operator +#define or +#define or_eq +#define private +#define protected +#define public +#define register +#define reinterpret_cast +#define return +#define short +#define signed +#define sizeof +#define static +#define static_assert +#define static_cast +#define struct +#define switch +#define template +#define this +#define thread_local +#define throw +#define true +#define try +#define typedef +#define typeid +#define typename +#define union +#define unsigned +#define using +#define virtual +#define void +#define volatile +#define wchar_t +#define while +#define xor +#define xor_eq + +// Check this is all properly defined away. +and +and_eq +alignas +alignof +asm +auto +bitand +bitor +bool +break +case +catch +char +char16_t +char32_t +class +compl +const +constexpr +const_cast +continue +decltype +default +delete +double +dynamic_cast +else +enum +explicit +export +extern +false +float +for +friend +goto +if +inline +int +long +mutable +namespace +new +noexcept +not +not_eq +nullptr +operator +or +or_eq +private +protected +public +register +reinterpret_cast +return +short +signed +sizeof +static +static_assert +static_cast +struct +switch +template +this +thread_local +throw +true +try +typedef +typeid +typename +union +unsigned +using +virtual +void +volatile +wchar_t +while +xor +xor_eq diff --git a/clang/test/Preprocessor/cxx_oper_spelling.cpp b/clang/test/Preprocessor/cxx_oper_spelling.cpp new file mode 100644 index 0000000..0ae9afd --- /dev/null +++ b/clang/test/Preprocessor/cxx_oper_spelling.cpp @@ -0,0 +1,11 @@ +// RUN: %clang_cc1 -E %s | grep 'a: "and"' + +#define X(A) #A + +// C++'03 2.5p2: "In all respects of the language, each alternative +// token behaves the same, respectively, as its primary token, +// except for its spelling" +// +// This should be spelled as 'and', not '&&' +a: X(and) + diff --git a/clang/test/Preprocessor/cxx_or.cpp b/clang/test/Preprocessor/cxx_or.cpp new file mode 100644 index 0000000..e8ed92f --- /dev/null +++ b/clang/test/Preprocessor/cxx_or.cpp @@ -0,0 +1,17 @@ +// RUN: %clang_cc1 -DA -DB -E %s | grep 'int a = 37 == 37' +// RUN: %clang_cc1 -DA -E %s | grep 'int a = 37 == 37' +// RUN: %clang_cc1 -DB -E %s | grep 'int a = 37 == 37' +// RUN: %clang_cc1 -E %s | grep 'int a = 927 == 927' +#if defined(A) or defined(B) +#define X 37 +#else +#define X 927 +#endif + +#if defined(A) || defined(B) +#define Y 37 +#else +#define Y 927 +#endif + +int a = X == Y; diff --git a/clang/test/Preprocessor/cxx_true.cpp b/clang/test/Preprocessor/cxx_true.cpp new file mode 100644 index 0000000..b123e0c --- /dev/null +++ b/clang/test/Preprocessor/cxx_true.cpp @@ -0,0 +1,13 @@ +/* RUN: %clang_cc1 -E %s -x c++ | grep block_1 + RUN: %clang_cc1 -E %s -x c++ | not grep block_2 + RUN: %clang_cc1 -E %s -x c | not grep block +*/ + +#if true +block_1 +#endif + +#if false +block_2 +#endif + diff --git a/clang/test/Preprocessor/cxx_xor.cpp b/clang/test/Preprocessor/cxx_xor.cpp new file mode 100644 index 0000000..24a6ce4 --- /dev/null +++ b/clang/test/Preprocessor/cxx_xor.cpp @@ -0,0 +1,18 @@ +// RUN: %clang_cc1 -DA=1 -DB=1 -E %s | grep 'int a = 927 == 927' +// RUN: %clang_cc1 -DA=0 -DB=1 -E %s | grep 'int a = 37 == 37' +// RUN: %clang_cc1 -DA=1 -DB=0 -E %s | grep 'int a = 37 == 37' +// RUN: %clang_cc1 -DA=0 -DB=0 -E %s | grep 'int a = 927 == 927' +// RUN: %clang_cc1 -E %s | grep 'int a = 927 == 927' +#if A xor B +#define X 37 +#else +#define X 927 +#endif + +#if A ^ B +#define Y 37 +#else +#define Y 927 +#endif + +int a = X == Y; diff --git a/clang/test/Preprocessor/dependencies-and-pp.c b/clang/test/Preprocessor/dependencies-and-pp.c new file mode 100644 index 0000000..7877df3 --- /dev/null +++ b/clang/test/Preprocessor/dependencies-and-pp.c @@ -0,0 +1,31 @@ +// Test -MT and -E flags, PR4063 + +// RUN: %clang -E -o %t.1 %s +// RUN: %clang -E -MD -MF %t.d -MT foo -o %t.2 %s +// RUN: diff %t.1 %t.2 +// RUN: grep "foo:" %t.d +// RUN: grep "dependencies-and-pp.c" %t.d + +// Test -MQ flag without quoting + +// RUN: %clang -E -MD -MF %t.d -MQ foo -o %t %s +// RUN: grep "foo:" %t.d + +// Test -MQ flag with quoting + +// RUN: %clang -E -MD -MF %t.d -MQ '$fo\ooo ooo\ ooo\\ ooo#oo' -o %t %s +// RUN: fgrep '$$fo\ooo\ ooo\\\ ooo\\\\\ ooo\#oo:' %t.d + +// Test consecutive -MT flags + +// RUN: %clang -E -MD -MF %t.d -MT foo -MT bar -MT baz -o %t %s +// RUN: diff %t.1 %t +// RUN: fgrep "foo bar baz:" %t.d + +// Test consecutive -MT and -MQ flags + +// RUN: %clang -E -MD -MF %t.d -MT foo -MQ '$(bar)' -MT 'b az' -MQ 'qu ux' -MQ ' space' -o %t %s +// RUN: fgrep 'foo $$(bar) b az qu\ ux \ space:' %t.d + +// TODO: Test default target without quoting +// TODO: Test default target with quoting diff --git a/clang/test/Preprocessor/directive-invalid.c b/clang/test/Preprocessor/directive-invalid.c new file mode 100644 index 0000000..86cd253 --- /dev/null +++ b/clang/test/Preprocessor/directive-invalid.c @@ -0,0 +1,7 @@ +// RUN: %clang_cc1 -E -verify %s +// rdar://7683173 + +#define r_paren ) +#if defined( x r_paren // expected-error {{missing ')' after 'defined'}} \ + // expected-note {{to match this '('}} +#endif diff --git a/clang/test/Preprocessor/disabled-cond-diags.c b/clang/test/Preprocessor/disabled-cond-diags.c new file mode 100644 index 0000000..531842a --- /dev/null +++ b/clang/test/Preprocessor/disabled-cond-diags.c @@ -0,0 +1,10 @@ +// RUN: %clang_cc1 -E %s 2>&1 | not grep "warning\|error" + +#if 0 + +// Shouldn't get warnings here. +??( ??) + +// Should not get an error here. +` ` ` ` +#endif diff --git a/clang/test/Preprocessor/dump-macros-spacing.c b/clang/test/Preprocessor/dump-macros-spacing.c new file mode 100644 index 0000000..1392442 --- /dev/null +++ b/clang/test/Preprocessor/dump-macros-spacing.c @@ -0,0 +1,13 @@ +// RUN: %clang_cc1 -E -dD < %s | grep stdin | grep -v define +#define A A +/* 1 + * 2 + * 3 + * 4 + * 5 + * 6 + * 7 + * 8 + */ +#define B B + diff --git a/clang/test/Preprocessor/dump-macros-undef.c b/clang/test/Preprocessor/dump-macros-undef.c new file mode 100644 index 0000000..358fd17 --- /dev/null +++ b/clang/test/Preprocessor/dump-macros-undef.c @@ -0,0 +1,8 @@ +// RUN: %clang_cc1 -E -dD %s | FileCheck %s +// PR7818 + +// CHECK: # 1 "{{.+}}.c" +#define X 3 +// CHECK: #define X 3 +#undef X +// CHECK: #undef X diff --git a/clang/test/Preprocessor/dump-options.c b/clang/test/Preprocessor/dump-options.c new file mode 100644 index 0000000..a329bd4 --- /dev/null +++ b/clang/test/Preprocessor/dump-options.c @@ -0,0 +1,3 @@ +// RUN: %clang %s -E -dD | grep __INTMAX_MAX__ +// RUN: %clang %s -E -dM | grep __INTMAX_MAX__ + diff --git a/clang/test/Preprocessor/dump_macros.c b/clang/test/Preprocessor/dump_macros.c new file mode 100644 index 0000000..d420eb4 --- /dev/null +++ b/clang/test/Preprocessor/dump_macros.c @@ -0,0 +1,38 @@ +// RUN: %clang_cc1 -E -dM %s -o - | FileCheck %s -strict-whitespace + +// Space at end even without expansion tokens +// CHECK: #define A(x) +#define A(x) + +// Space before expansion list. +// CHECK: #define B(x,y) x y +#define B(x,y)x y + +// No space in argument list. +// CHECK: #define C(x,y) x y +#define C(x, y) x y + +// No paste avoidance. +// CHECK: #define D() .. +#define D() .. + +// Simple test. +// CHECK: #define E . +// CHECK: #define F X()Y +#define E . +#define F X()Y + +// gcc prints macros at end of translation unit, so last one wins. +// CHECK: #define G 2 +#define G 1 +#undef G +#define G 2 + +// Variadic macros of various sorts. PR5699 + +// CHECK: H(x,...) __VA_ARGS__ +#define H(x, ...) __VA_ARGS__ +// CHECK: I(...) __VA_ARGS__ +#define I(...) __VA_ARGS__ +// CHECK: J(x...) __VA_ARGS__ +#define J(x ...) __VA_ARGS__ diff --git a/clang/test/Preprocessor/dumptokens_phyloc.c b/clang/test/Preprocessor/dumptokens_phyloc.c new file mode 100644 index 0000000..7321c0e --- /dev/null +++ b/clang/test/Preprocessor/dumptokens_phyloc.c @@ -0,0 +1,5 @@ +// RUN: %clang_cc1 -dump-tokens %s 2>&1 | grep "Spelling=.*dumptokens_phyloc.c:3:20" + +#define TESTPHYLOC 10 + +TESTPHYLOC diff --git a/clang/test/Preprocessor/expr_comma.c b/clang/test/Preprocessor/expr_comma.c new file mode 100644 index 0000000..538727d --- /dev/null +++ b/clang/test/Preprocessor/expr_comma.c @@ -0,0 +1,10 @@ +// Comma is not allowed in C89 +// RUN: not %clang_cc1 -E %s -std=c89 -pedantic-errors + +// Comma is allowed if unevaluated in C99 +// RUN: %clang_cc1 -E %s -std=c99 -pedantic-errors + +// PR2279 + +#if 0? 1,2:3 +#endif diff --git a/clang/test/Preprocessor/expr_define_expansion.c b/clang/test/Preprocessor/expr_define_expansion.c new file mode 100644 index 0000000..38c0384 --- /dev/null +++ b/clang/test/Preprocessor/expr_define_expansion.c @@ -0,0 +1,5 @@ +// RUN: %clang_cc1 %s -E -CC -pedantic -verify + +#define FOO && 1 +#if defined FOO FOO +#endif diff --git a/clang/test/Preprocessor/expr_invalid_tok.c b/clang/test/Preprocessor/expr_invalid_tok.c new file mode 100644 index 0000000..5defcc5 --- /dev/null +++ b/clang/test/Preprocessor/expr_invalid_tok.c @@ -0,0 +1,15 @@ +// RUN: not %clang_cc1 -E %s 2>&1 | grep 'invalid token at start of a preprocessor expression' +// RUN: not %clang_cc1 -E %s 2>&1 | grep 'token is not a valid binary operator in a preprocessor subexpression' +// RUN: not %clang_cc1 -E %s 2>&1 | grep ':14: error: expected end of line in preprocessor expression' +// PR2220 + +#if 1 * * 2 +#endif + +#if 4 [ 2 +#endif + + +// PR2284 - The constant-expr production does not including comma. +#if 1 ? 2 : 0, 1 +#endif diff --git a/clang/test/Preprocessor/expr_liveness.c b/clang/test/Preprocessor/expr_liveness.c new file mode 100644 index 0000000..c3b6421 --- /dev/null +++ b/clang/test/Preprocessor/expr_liveness.c @@ -0,0 +1,52 @@ +/* RUN: %clang_cc1 -E %s -DNO_ERRORS -Werror -Wundef + RUN: not %clang_cc1 -E %s + */ + +#ifdef NO_ERRORS +/* None of these divisions by zero are in live parts of the expression, do not + emit any diagnostics. */ + +#define MACRO_0 0 +#define MACRO_1 1 + +#if MACRO_0 && 10 / MACRO_0 +foo +#endif + +#if MACRO_1 || 10 / MACRO_0 +bar +#endif + +#if 0 ? 124/0 : 42 +#endif + +// PR2279 +#if 0 ? 1/0: 2 +#else +#error +#endif + +// PR2279 +#if 1 ? 2 ? 3 : 4 : 5 +#endif + +// PR2284 +#if 1 ? 0: 1 ? 1/0: 1/0 +#endif + +#else + + +/* The 1/0 is live, it should error out. */ +#if 0 && 1 ? 4 : 1 / 0 +baz +#endif + + +#endif + +// rdar://6505352 +// -Wundef should not warn about use of undefined identifier if not live. +#if (!defined(XXX) || XXX > 42) +#endif + diff --git a/clang/test/Preprocessor/expr_multichar.c b/clang/test/Preprocessor/expr_multichar.c new file mode 100644 index 0000000..8ab12d9 --- /dev/null +++ b/clang/test/Preprocessor/expr_multichar.c @@ -0,0 +1,5 @@ +// RUN: %clang_cc1 < %s -E -verify -triple i686-pc-linux-gnu + +#if (('1234' >> 24) != '1') +#error Bad multichar constant calculation! +#endif diff --git a/clang/test/Preprocessor/expr_usual_conversions.c b/clang/test/Preprocessor/expr_usual_conversions.c new file mode 100644 index 0000000..5ca2cb8 --- /dev/null +++ b/clang/test/Preprocessor/expr_usual_conversions.c @@ -0,0 +1,14 @@ +// RUN: %clang_cc1 %s -E -verify + +#define INTMAX_MIN (-9223372036854775807LL -1) + +#if (-42 + 0U) /* expected-warning {{left side of operator converted from negative value to unsigned: -42 to 18446744073709551574}} */ \ + / -2 /* expected-warning {{right side of operator converted from negative value to unsigned: -2 to 18446744073709551614}} */ +foo +#endif + +// Shifts don't want the usual conversions: PR2279 +#if (2 << 1U) - 30 >= 0 +#error +#endif + diff --git a/clang/test/Preprocessor/extension-warning.c b/clang/test/Preprocessor/extension-warning.c new file mode 100644 index 0000000..4ba57f7 --- /dev/null +++ b/clang/test/Preprocessor/extension-warning.c @@ -0,0 +1,18 @@ +// RUN: %clang_cc1 -fsyntax-only -verify -pedantic %s + +// The preprocessor shouldn't warn about extensions within macro bodies that +// aren't expanded. +#define TY typeof +#define TY1 typeof(1) + +// But we should warn here +TY1 x; // expected-warning {{extension}} +TY(1) x; // FIXME: And we should warn here + +// Note: this warning intentionally doesn't trigger on keywords like +// __attribute; the standard allows implementation-defined extensions +// prefixed with "__". +// Current list of keywords this can trigger on: +// inline, restrict, asm, typeof, _asm + +void whatever() {} diff --git a/clang/test/Preprocessor/feature_tests.c b/clang/test/Preprocessor/feature_tests.c new file mode 100644 index 0000000..b78a251 --- /dev/null +++ b/clang/test/Preprocessor/feature_tests.c @@ -0,0 +1,34 @@ +// RUN: %clang_cc1 %s -triple=i686-apple-darwin9 +// RUN: %clang_cc1 %s -E -triple=i686-apple-darwin9 +#ifndef __has_feature +#error Should have __has_feature +#endif + + +#if __has_feature(something_we_dont_have) +#error Bad +#endif + +#if !__has_builtin(__builtin_huge_val) || \ + !__has_builtin(__builtin_shufflevector) || \ + !__has_builtin(__builtin_trap) || \ + !__has_builtin(__c11_atomic_init) || \ + !__has_feature(attribute_analyzer_noreturn) || \ + !__has_feature(attribute_overloadable) +#error Clang should have these +#endif + +#if __has_builtin(__builtin_insanity) +#error Clang should not have this +#endif + +#if !__has_feature(__attribute_deprecated_with_message__) +#error Feature name in double underscores does not work +#endif + +// Make sure we have x86 builtins only (forced with target triple). + +#if !__has_builtin(__builtin_ia32_emms) || \ + __has_builtin(__builtin_altivec_abs_v4sf) +#error Broken handling of target-specific builtins +#endif diff --git a/clang/test/Preprocessor/file_to_include.h b/clang/test/Preprocessor/file_to_include.h new file mode 100644 index 0000000..97728ab --- /dev/null +++ b/clang/test/Preprocessor/file_to_include.h @@ -0,0 +1,3 @@ + +#warning file successfully included + diff --git a/clang/test/Preprocessor/function_macro_file.c b/clang/test/Preprocessor/function_macro_file.c new file mode 100644 index 0000000..c97bb75 --- /dev/null +++ b/clang/test/Preprocessor/function_macro_file.c @@ -0,0 +1,5 @@ +/* RUN: %clang_cc1 -E -P %s | grep f + */ + +#include "function_macro_file.h" +() diff --git a/clang/test/Preprocessor/function_macro_file.h b/clang/test/Preprocessor/function_macro_file.h new file mode 100644 index 0000000..43d1199 --- /dev/null +++ b/clang/test/Preprocessor/function_macro_file.h @@ -0,0 +1,3 @@ + +#define f() x +f diff --git a/clang/test/Preprocessor/has_attribute.c b/clang/test/Preprocessor/has_attribute.c new file mode 100644 index 0000000..80f53a5 --- /dev/null +++ b/clang/test/Preprocessor/has_attribute.c @@ -0,0 +1,26 @@ +// RUN: %clang_cc1 -E %s -o - | FileCheck %s + +// CHECK: always_inline +#if __has_attribute(always_inline) +int always_inline(); +#endif + +// CHECK: __always_inline__ +#if __has_attribute(__always_inline__) +int __always_inline__(); +#endif + +// CHECK: no_dummy_attribute +#if !__has_attribute(dummy_attribute) +int no_dummy_attribute(); +#endif + +// CHECK: has_has_attribute +#ifdef __has_attribute +int has_has_attribute(); +#endif + +// CHECK: has_something_we_dont_have +#if !__has_attribute(something_we_dont_have) +int has_something_we_dont_have(); +#endif diff --git a/clang/test/Preprocessor/has_include.c b/clang/test/Preprocessor/has_include.c new file mode 100644 index 0000000..fdcae78 --- /dev/null +++ b/clang/test/Preprocessor/has_include.c @@ -0,0 +1,83 @@ +// RUN: %clang_cc1 -ffreestanding -Eonly -verify %s + +// Try different path permutations of __has_include with existing file. +#if __has_include("stdint.h") +#else + #error "__has_include failed (1)." +#endif + +#if __has_include() +#else + #error "__has_include failed (2)." +#endif + +// Try unary expression. +#if !__has_include("stdint.h") + #error "__has_include failed (5)." +#endif + +// Try binary expression. +#if __has_include("stdint.h") && __has_include("stddef.h") +#else + #error "__has_include failed (6)." +#endif + +// Try non-existing file. +#if __has_include("blahblah.h") + #error "__has_include failed (7)." +#endif + +// Try defined. +#if !defined(__has_include) + #error "defined(__has_include) failed (8)." +#endif + +// Try different path permutations of __has_include_next with existing file. +#if __has_include_next("stddef.h") // expected-warning {{#include_next in primary source file}} +#else + #error "__has_include failed (1)." +#endif + +#if __has_include_next() // expected-warning {{#include_next in primary source file}} +#else + #error "__has_include failed (2)." +#endif + +// Try unary expression. +#if !__has_include_next("stdint.h") // expected-warning {{#include_next in primary source file}} + #error "__has_include_next failed (5)." +#endif + +// Try binary expression. +#if __has_include_next("stdint.h") && __has_include("stddef.h") // expected-warning {{#include_next in primary source file}} +#else + #error "__has_include_next failed (6)." +#endif + +// Try non-existing file. +#if __has_include_next("blahblah.h") // expected-warning {{#include_next in primary source file}} + #error "__has_include_next failed (7)." +#endif + +// Try defined. +#if !defined(__has_include_next) + #error "defined(__has_include_next) failed (8)." +#endif + +// Try badly formed expressions. +// FIXME: I don't quite know how to avoid preprocessor side effects. +// Use FileCheck? +// It also assert due to unterminated #if's. +//#if __has_include("stdint.h" +//#if __has_include "stdint.h") +//#if __has_include(stdint.h) +//#if __has_include() +//#if __has_include( +//#if __has_include) +//#if __has_include +//#if __has_include( +//#if __has_include) +//#if __has_include("stdint.h) +//#if __has_include(stdint.h") +//#if __has_include() diff --git a/clang/test/Preprocessor/hash_line.c b/clang/test/Preprocessor/hash_line.c new file mode 100644 index 0000000..4f724df --- /dev/null +++ b/clang/test/Preprocessor/hash_line.c @@ -0,0 +1,8 @@ +// The 1 and # should not go on the same line. +// RUN: %clang_cc1 %s -E | not grep "1 #" +// RUN: %clang_cc1 %s -E | grep '^1$' +// RUN: %clang_cc1 %s -E | grep '^ #$' +1 +#define EMPTY +EMPTY # + diff --git a/clang/test/Preprocessor/hash_space.c b/clang/test/Preprocessor/hash_space.c new file mode 100644 index 0000000..ac97556 --- /dev/null +++ b/clang/test/Preprocessor/hash_space.c @@ -0,0 +1,6 @@ +// RUN: %clang_cc1 %s -E | grep " #" + +// Should put a space before the # so that -fpreprocessed mode doesn't +// macro expand this again. +#define HASH # +HASH define foo bar diff --git a/clang/test/Preprocessor/header_lookup1.c b/clang/test/Preprocessor/header_lookup1.c new file mode 100644 index 0000000..d090936 --- /dev/null +++ b/clang/test/Preprocessor/header_lookup1.c @@ -0,0 +1,2 @@ +// RUN: %clang -fno-ms-extensions %s -E | grep 'stddef.h.*3' +#include diff --git a/clang/test/Preprocessor/if_warning.c b/clang/test/Preprocessor/if_warning.c new file mode 100644 index 0000000..641ec3b --- /dev/null +++ b/clang/test/Preprocessor/if_warning.c @@ -0,0 +1,31 @@ +// RUN: %clang_cc1 %s -Eonly -Werror=undef -verify +// RUN: %clang_cc1 %s -Eonly -Werror-undef -verify + +extern int x; + +#if foo // expected-error {{'foo' is not defined, evaluates to 0}} +#endif + +#ifdef foo +#endif + +#if defined(foo) +#endif + + +// PR3938 +#if 0 +#ifdef D +#else 1 // Should not warn due to C99 6.10p4 +#endif +#endif + +// rdar://9475098 +#if 0 +#else 1 // expected-warning {{extra tokens}} +#endif + +// PR6852 +#if 'somesillylongthing' // expected-warning {{character constant too long for its type}} \ + // expected-warning {{multi-character character constant}} +#endif diff --git a/clang/test/Preprocessor/ifdef-recover.c b/clang/test/Preprocessor/ifdef-recover.c new file mode 100644 index 0000000..51d06d1 --- /dev/null +++ b/clang/test/Preprocessor/ifdef-recover.c @@ -0,0 +1,15 @@ +/* RUN: %clang_cc1 -E %s 2>&1 >/dev/null | grep error: | count 3 + */ + +#ifdef + +#endif + +/* End of function-like macro invocation in #ifdef */ +/* PR1936 */ +#define f(x) x +#if f(2 +#endif + +int x; + diff --git a/clang/test/Preprocessor/import_self.c b/clang/test/Preprocessor/import_self.c new file mode 100644 index 0000000..8ba0b19 --- /dev/null +++ b/clang/test/Preprocessor/import_self.c @@ -0,0 +1,7 @@ +// RUN: %clang_cc1 -E -I. %s | grep BODY_OF_FILE | wc -l | grep 1 + +// This #import should have no effect, as we're importing the current file. +#import + +BODY_OF_FILE + diff --git a/clang/test/Preprocessor/include-directive1.c b/clang/test/Preprocessor/include-directive1.c new file mode 100644 index 0000000..20f4582 --- /dev/null +++ b/clang/test/Preprocessor/include-directive1.c @@ -0,0 +1,14 @@ +// RUN: %clang_cc1 -E %s -fno-caret-diagnostics 2>&1 >/dev/null | grep 'file successfully included' | count 3 + +// XX expands to nothing. +#define XX + +// expand macros to get to file to include +#define FILE "file_to_include.h" +#include XX FILE + +#include FILE + +// normal include +#include "file_to_include.h" + diff --git a/clang/test/Preprocessor/include-directive2.c b/clang/test/Preprocessor/include-directive2.c new file mode 100644 index 0000000..b1a9940 --- /dev/null +++ b/clang/test/Preprocessor/include-directive2.c @@ -0,0 +1,17 @@ +// RUN: %clang_cc1 -ffreestanding -Eonly -verify %s +# define HEADER + +# include HEADER + +#include NON_EMPTY // expected-warning {{extra tokens at end of #include directive}} + +// PR3916: these are ok. +#define EMPTY +#include EMPTY +#include HEADER EMPTY + +// PR3916 +#define FN limits.h> +#include // expected-error {{empty filename}} diff --git a/clang/test/Preprocessor/include-directive3.c b/clang/test/Preprocessor/include-directive3.c new file mode 100644 index 0000000..c0e2ae1 --- /dev/null +++ b/clang/test/Preprocessor/include-directive3.c @@ -0,0 +1,3 @@ +// RUN: %clang_cc1 -include %S/file_to_include.h -E %s -fno-caret-diagnostics 2>&1 >/dev/null | grep 'file successfully included' | count 1 +// PR3464 + diff --git a/clang/test/Preprocessor/include-macros.c b/clang/test/Preprocessor/include-macros.c new file mode 100644 index 0000000..b86cd0d --- /dev/null +++ b/clang/test/Preprocessor/include-macros.c @@ -0,0 +1,4 @@ +// RUN: %clang_cc1 -E -Dtest=FOO -imacros %S/pr2086.h %s | grep 'HERE: test' + +// This should not be expanded into FOO because pr2086.h undefs 'test'. +HERE: test diff --git a/clang/test/Preprocessor/include-pth.c b/clang/test/Preprocessor/include-pth.c new file mode 100644 index 0000000..e1d6685 --- /dev/null +++ b/clang/test/Preprocessor/include-pth.c @@ -0,0 +1,3 @@ +// RUN: %clang_cc1 -emit-pth %s -o %t +// RUN: %clang_cc1 -include-pth %t %s -E | grep 'file_to_include' | count 2 +#include "file_to_include.h" diff --git a/clang/test/Preprocessor/indent_macro.c b/clang/test/Preprocessor/indent_macro.c new file mode 100644 index 0000000..e695007 --- /dev/null +++ b/clang/test/Preprocessor/indent_macro.c @@ -0,0 +1,6 @@ +// RUN: %clang_cc1 -E %s | grep '^ zzap$' + +// zzap is on a new line, should be indented. +#define BLAH zzap + BLAH + diff --git a/clang/test/Preprocessor/init.c b/clang/test/Preprocessor/init.c new file mode 100644 index 0000000..e0f45f1 --- /dev/null +++ b/clang/test/Preprocessor/init.c @@ -0,0 +1,1764 @@ +// RUN: %clang_cc1 -E -dM -x assembler-with-cpp < /dev/null | FileCheck -check-prefix ASM %s +// +// ASM:#define __ASSEMBLER__ 1 +// +// +// RUN: %clang_cc1 -fblocks -E -dM < /dev/null | FileCheck -check-prefix BLOCKS %s +// +// BLOCKS:#define __BLOCKS__ 1 +// BLOCKS:#define __block __attribute__((__blocks__(byref))) +// +// +// RUN: %clang_cc1 -x c++ -std=c++11 -E -dM < /dev/null | FileCheck -check-prefix CXX0X %s +// +// CXX0X:#define __GNUG__ +// CXX0X:#define __GXX_EXPERIMENTAL_CXX0X__ 1 +// CXX0X:#define __GXX_RTTI 1 +// CXX0X:#define __GXX_WEAK__ 1 +// CXX0X:#define __cplusplus 201103L +// CXX0X:#define __private_extern__ extern +// +// +// RUN: %clang_cc1 -x c++ -std=c++98 -E -dM < /dev/null | FileCheck -check-prefix CXX98 %s +// +// CXX98:#define __GNUG__ +// CXX98:#define __GXX_RTTI 1 +// CXX98:#define __GXX_WEAK__ 1 +// CXX98:#define __cplusplus 199711L +// CXX98:#define __private_extern__ extern +// +// +// RUN: %clang_cc1 -fdeprecated-macro -E -dM < /dev/null | FileCheck -check-prefix DEPRECATED %s +// +// DEPRECATED:#define __DEPRECATED 1 +// +// +// RUN: %clang_cc1 -std=c99 -E -dM < /dev/null | FileCheck -check-prefix C99 %s +// +// C99:#define __STDC_VERSION__ 199901L +// C99:#define __STRICT_ANSI__ 1 +// +// +// RUN: %clang_cc1 -E -dM < /dev/null | FileCheck -check-prefix COMMON %s +// +// COMMON:#define __CONSTANT_CFSTRINGS__ 1 +// COMMON:#define __FINITE_MATH_ONLY__ 0 +// COMMON:#define __GNUC_MINOR__ +// COMMON:#define __GNUC_PATCHLEVEL__ +// COMMON:#define __GNUC_STDC_INLINE__ 1 +// COMMON:#define __GNUC__ +// COMMON:#define __GXX_ABI_VERSION +// COMMON:#define __STDC_HOSTED__ 1 +// COMMON:#define __STDC_VERSION__ +// COMMON:#define __STDC__ 1 +// COMMON:#define __VERSION__ +// COMMON:#define __clang__ 1 +// COMMON:#define __clang_major__ {{[0-9]+}} +// COMMON:#define __clang_minor__ {{[0-9]+}} +// COMMON:#define __clang_patchlevel__ {{[0-9]+}} +// COMMON:#define __clang_version__ +// COMMON:#define __llvm__ 1 +// +// +// RUN: %clang_cc1 -ffreestanding -E -dM < /dev/null | FileCheck -check-prefix FREESTANDING %s +// FREESTANDING:#define __STDC_HOSTED__ 0 +// +// RUN: %clang_cc1 -x c++ -std=gnu++98 -E -dM < /dev/null | FileCheck -check-prefix GXX98 %s +// +// GXX98:#define __GNUG__ +// GXX98:#define __GXX_WEAK__ 1 +// GXX98:#define __cplusplus 1 +// GXX98:#define __private_extern__ extern +// +// +// RUN: %clang_cc1 -std=iso9899:199409 -E -dM < /dev/null | FileCheck -check-prefix C94 %s +// +// C94:#define __STDC_VERSION__ 199409L +// +// +// RUN: %clang_cc1 -fms-extensions -triple i686-pc-win32 -fobjc-fragile-abi -E -dM < /dev/null | FileCheck -check-prefix MSEXT %s +// +// MSEXT-NOT:#define __STDC__ +// MSEXT:#define _INTEGRAL_MAX_BITS 64 +// +// +// RUN: %clang_cc1 -x objective-c -E -dM < /dev/null | FileCheck -check-prefix OBJC %s +// +// OBJC:#define OBJC_NEW_PROPERTIES 1 +// OBJC:#define __NEXT_RUNTIME__ 1 +// OBJC:#define __OBJC__ 1 +// +// +// RUN: %clang_cc1 -x objective-c -fobjc-gc -E -dM < /dev/null | FileCheck -check-prefix OBJCGC %s +// +// OBJCGC:#define __OBJC_GC__ 1 +// +// +// RUN: %clang_cc1 -x objective-c -fobjc-exceptions -E -dM < /dev/null | FileCheck -check-prefix NONFRAGILE %s +// +// NONFRAGILE:#define OBJC_ZEROCOST_EXCEPTIONS 1 +// NONFRAGILE:#define __OBJC2__ 1 +// +// +// RUN: %clang_cc1 -O1 -E -dM < /dev/null | FileCheck -check-prefix O1 %s +// +// O1:#define __OPTIMIZE__ 1 +// +// +// RUN: %clang_cc1 -fpascal-strings -E -dM < /dev/null | FileCheck -check-prefix PASCAL %s +// +// PASCAL:#define __PASCAL_STRINGS__ 1 +// +// +// RUN: %clang_cc1 -E -dM < /dev/null | FileCheck -check-prefix SCHAR %s +// +// SCHAR:#define __STDC__ 1 +// SCHAR-NOT:#define __UNSIGNED_CHAR__ +// SCHAR:#define __clang__ 1 +// +// RUN: %clang_cc1 -E -dM -fshort-wchar < /dev/null | FileCheck -check-prefix SHORTWCHAR %s +// +// SHORTWCHAR: #define __SIZEOF_WCHAR_T__ 2 +// SHORTWCHAR: #define __WCHAR_MAX__ 65535U +// SHORTWCHAR: #define __WCHAR_TYPE__ unsigned short +// SHORTWCHAR: #define __WCHAR_WIDTH__ 16 +// +// RUN: %clang_cc1 -E -dM -ffreestanding -triple=arm-none-none < /dev/null | FileCheck -check-prefix ARM %s +// +// ARM:#define __APCS_32__ 1 +// ARM:#define __ARMEL__ 1 +// ARM:#define __ARM_ARCH_6J__ 1 +// ARM:#define __CHAR16_TYPE__ unsigned short +// ARM:#define __CHAR32_TYPE__ unsigned int +// ARM:#define __CHAR_BIT__ 8 +// ARM:#define __DBL_DENORM_MIN__ 4.9406564584124654e-324 +// ARM:#define __DBL_DIG__ 15 +// ARM:#define __DBL_EPSILON__ 2.2204460492503131e-16 +// ARM:#define __DBL_HAS_DENORM__ 1 +// ARM:#define __DBL_HAS_INFINITY__ 1 +// ARM:#define __DBL_HAS_QUIET_NAN__ 1 +// ARM:#define __DBL_MANT_DIG__ 53 +// ARM:#define __DBL_MAX_10_EXP__ 308 +// ARM:#define __DBL_MAX_EXP__ 1024 +// ARM:#define __DBL_MAX__ 1.7976931348623157e+308 +// ARM:#define __DBL_MIN_10_EXP__ (-307) +// ARM:#define __DBL_MIN_EXP__ (-1021) +// ARM:#define __DBL_MIN__ 2.2250738585072014e-308 +// ARM:#define __DECIMAL_DIG__ 17 +// ARM:#define __FLT_DENORM_MIN__ 1.40129846e-45F +// ARM:#define __FLT_DIG__ 6 +// ARM:#define __FLT_EPSILON__ 1.19209290e-7F +// ARM:#define __FLT_EVAL_METHOD__ 0 +// ARM:#define __FLT_HAS_DENORM__ 1 +// ARM:#define __FLT_HAS_INFINITY__ 1 +// ARM:#define __FLT_HAS_QUIET_NAN__ 1 +// ARM:#define __FLT_MANT_DIG__ 24 +// ARM:#define __FLT_MAX_10_EXP__ 38 +// ARM:#define __FLT_MAX_EXP__ 128 +// ARM:#define __FLT_MAX__ 3.40282347e+38F +// ARM:#define __FLT_MIN_10_EXP__ (-37) +// ARM:#define __FLT_MIN_EXP__ (-125) +// ARM:#define __FLT_MIN__ 1.17549435e-38F +// ARM:#define __FLT_RADIX__ 2 +// ARM:#define __INT16_TYPE__ short +// ARM:#define __INT32_TYPE__ int +// ARM:#define __INT64_C_SUFFIX__ LL +// ARM:#define __INT64_TYPE__ long long int +// ARM:#define __INT8_TYPE__ char +// ARM:#define __INTMAX_MAX__ 9223372036854775807LL +// ARM:#define __INTMAX_TYPE__ long long int +// ARM:#define __INTMAX_WIDTH__ 64 +// ARM:#define __INTPTR_TYPE__ long int +// ARM:#define __INTPTR_WIDTH__ 32 +// ARM:#define __INT_MAX__ 2147483647 +// ARM:#define __LDBL_DENORM_MIN__ 4.9406564584124654e-324 +// ARM:#define __LDBL_DIG__ 15 +// ARM:#define __LDBL_EPSILON__ 2.2204460492503131e-16 +// ARM:#define __LDBL_HAS_DENORM__ 1 +// ARM:#define __LDBL_HAS_INFINITY__ 1 +// ARM:#define __LDBL_HAS_QUIET_NAN__ 1 +// ARM:#define __LDBL_MANT_DIG__ 53 +// ARM:#define __LDBL_MAX_10_EXP__ 308 +// ARM:#define __LDBL_MAX_EXP__ 1024 +// ARM:#define __LDBL_MAX__ 1.7976931348623157e+308 +// ARM:#define __LDBL_MIN_10_EXP__ (-307) +// ARM:#define __LDBL_MIN_EXP__ (-1021) +// ARM:#define __LDBL_MIN__ 2.2250738585072014e-308 +// ARM:#define __LITTLE_ENDIAN__ 1 +// ARM:#define __LONG_LONG_MAX__ 9223372036854775807LL +// ARM:#define __LONG_MAX__ 2147483647L +// ARM:#define __NO_INLINE__ 1 +// ARM:#define __POINTER_WIDTH__ 32 +// ARM:#define __PTRDIFF_TYPE__ int +// ARM:#define __PTRDIFF_WIDTH__ 32 +// ARM:#define __REGISTER_PREFIX__ +// ARM:#define __SCHAR_MAX__ 127 +// ARM:#define __SHRT_MAX__ 32767 +// ARM:#define __SIG_ATOMIC_WIDTH__ 32 +// ARM:#define __SIZEOF_DOUBLE__ 8 +// ARM:#define __SIZEOF_FLOAT__ 4 +// ARM:#define __SIZEOF_INT__ 4 +// ARM:#define __SIZEOF_LONG_DOUBLE__ 8 +// ARM:#define __SIZEOF_LONG_LONG__ 8 +// ARM:#define __SIZEOF_LONG__ 4 +// ARM:#define __SIZEOF_POINTER__ 4 +// ARM:#define __SIZEOF_PTRDIFF_T__ 4 +// ARM:#define __SIZEOF_SHORT__ 2 +// ARM:#define __SIZEOF_SIZE_T__ 4 +// ARM:#define __SIZEOF_WCHAR_T__ 4 +// ARM:#define __SIZEOF_WINT_T__ 4 +// ARM:#define __SIZE_TYPE__ unsigned int +// ARM:#define __SIZE_WIDTH__ 32 +// ARM:#define __THUMB_INTERWORK__ 1 +// ARM:#define __UINTMAX_TYPE__ long long unsigned int +// ARM:#define __USER_LABEL_PREFIX__ _ +// ARM:#define __WCHAR_MAX__ 4294967295U +// ARM:#define __WCHAR_TYPE__ unsigned int +// ARM:#define __WCHAR_WIDTH__ 32 +// ARM:#define __WINT_TYPE__ int +// ARM:#define __WINT_WIDTH__ 32 +// ARM:#define __arm 1 +// ARM:#define __arm__ 1 +// +// RUN: %clang_cc1 -E -dM -ffreestanding -triple=i386-none-none < /dev/null | FileCheck -check-prefix I386 %s +// +// I386:#define __CHAR16_TYPE__ unsigned short +// I386:#define __CHAR32_TYPE__ unsigned int +// I386:#define __CHAR_BIT__ 8 +// I386:#define __DBL_DENORM_MIN__ 4.9406564584124654e-324 +// I386:#define __DBL_DIG__ 15 +// I386:#define __DBL_EPSILON__ 2.2204460492503131e-16 +// I386:#define __DBL_HAS_DENORM__ 1 +// I386:#define __DBL_HAS_INFINITY__ 1 +// I386:#define __DBL_HAS_QUIET_NAN__ 1 +// I386:#define __DBL_MANT_DIG__ 53 +// I386:#define __DBL_MAX_10_EXP__ 308 +// I386:#define __DBL_MAX_EXP__ 1024 +// I386:#define __DBL_MAX__ 1.7976931348623157e+308 +// I386:#define __DBL_MIN_10_EXP__ (-307) +// I386:#define __DBL_MIN_EXP__ (-1021) +// I386:#define __DBL_MIN__ 2.2250738585072014e-308 +// I386:#define __DECIMAL_DIG__ 21 +// I386:#define __FLT_DENORM_MIN__ 1.40129846e-45F +// I386:#define __FLT_DIG__ 6 +// I386:#define __FLT_EPSILON__ 1.19209290e-7F +// I386:#define __FLT_EVAL_METHOD__ 2 +// I386:#define __FLT_HAS_DENORM__ 1 +// I386:#define __FLT_HAS_INFINITY__ 1 +// I386:#define __FLT_HAS_QUIET_NAN__ 1 +// I386:#define __FLT_MANT_DIG__ 24 +// I386:#define __FLT_MAX_10_EXP__ 38 +// I386:#define __FLT_MAX_EXP__ 128 +// I386:#define __FLT_MAX__ 3.40282347e+38F +// I386:#define __FLT_MIN_10_EXP__ (-37) +// I386:#define __FLT_MIN_EXP__ (-125) +// I386:#define __FLT_MIN__ 1.17549435e-38F +// I386:#define __FLT_RADIX__ 2 +// I386:#define __INT16_TYPE__ short +// I386:#define __INT32_TYPE__ int +// I386:#define __INT64_C_SUFFIX__ LL +// I386:#define __INT64_TYPE__ long long int +// I386:#define __INT8_TYPE__ char +// I386:#define __INTMAX_MAX__ 9223372036854775807LL +// I386:#define __INTMAX_TYPE__ long long int +// I386:#define __INTMAX_WIDTH__ 64 +// I386:#define __INTPTR_TYPE__ int +// I386:#define __INTPTR_WIDTH__ 32 +// I386:#define __INT_MAX__ 2147483647 +// I386:#define __LDBL_DENORM_MIN__ 3.64519953188247460253e-4951L +// I386:#define __LDBL_DIG__ 18 +// I386:#define __LDBL_EPSILON__ 1.08420217248550443401e-19L +// I386:#define __LDBL_HAS_DENORM__ 1 +// I386:#define __LDBL_HAS_INFINITY__ 1 +// I386:#define __LDBL_HAS_QUIET_NAN__ 1 +// I386:#define __LDBL_MANT_DIG__ 64 +// I386:#define __LDBL_MAX_10_EXP__ 4932 +// I386:#define __LDBL_MAX_EXP__ 16384 +// I386:#define __LDBL_MAX__ 1.18973149535723176502e+4932L +// I386:#define __LDBL_MIN_10_EXP__ (-4931) +// I386:#define __LDBL_MIN_EXP__ (-16381) +// I386:#define __LDBL_MIN__ 3.36210314311209350626e-4932L +// I386:#define __LITTLE_ENDIAN__ 1 +// I386:#define __LONG_LONG_MAX__ 9223372036854775807LL +// I386:#define __LONG_MAX__ 2147483647L +// I386:#define __NO_INLINE__ 1 +// I386:#define __NO_MATH_INLINES 1 +// I386:#define __POINTER_WIDTH__ 32 +// I386:#define __PTRDIFF_TYPE__ int +// I386:#define __PTRDIFF_WIDTH__ 32 +// I386:#define __REGISTER_PREFIX__ +// I386:#define __SCHAR_MAX__ 127 +// I386:#define __SHRT_MAX__ 32767 +// I386:#define __SIG_ATOMIC_WIDTH__ 32 +// I386:#define __SIZEOF_DOUBLE__ 8 +// I386:#define __SIZEOF_FLOAT__ 4 +// I386:#define __SIZEOF_INT__ 4 +// I386:#define __SIZEOF_LONG_DOUBLE__ 12 +// I386:#define __SIZEOF_LONG_LONG__ 8 +// I386:#define __SIZEOF_LONG__ 4 +// I386:#define __SIZEOF_POINTER__ 4 +// I386:#define __SIZEOF_PTRDIFF_T__ 4 +// I386:#define __SIZEOF_SHORT__ 2 +// I386:#define __SIZEOF_SIZE_T__ 4 +// I386:#define __SIZEOF_WCHAR_T__ 4 +// I386:#define __SIZEOF_WINT_T__ 4 +// I386:#define __SIZE_TYPE__ unsigned int +// I386:#define __SIZE_WIDTH__ 32 +// I386:#define __UINTMAX_TYPE__ long long unsigned int +// I386:#define __USER_LABEL_PREFIX__ _ +// I386:#define __WCHAR_MAX__ 2147483647 +// I386:#define __WCHAR_TYPE__ int +// I386:#define __WCHAR_WIDTH__ 32 +// I386:#define __WINT_TYPE__ int +// I386:#define __WINT_WIDTH__ 32 +// I386:#define __i386 1 +// I386:#define __i386__ 1 +// I386:#define i386 1 +// +// RUN: %clang_cc1 -E -dM -ffreestanding -triple=i386-pc-linux-gnu -target-cpu pentium4 < /dev/null | FileCheck -check-prefix I386-LINUX %s +// +// I386-LINUX:#define __CHAR16_TYPE__ unsigned short +// I386-LINUX:#define __CHAR32_TYPE__ unsigned int +// I386-LINUX:#define __CHAR_BIT__ 8 +// I386-LINUX:#define __DBL_DENORM_MIN__ 4.9406564584124654e-324 +// I386-LINUX:#define __DBL_DIG__ 15 +// I386-LINUX:#define __DBL_EPSILON__ 2.2204460492503131e-16 +// I386-LINUX:#define __DBL_HAS_DENORM__ 1 +// I386-LINUX:#define __DBL_HAS_INFINITY__ 1 +// I386-LINUX:#define __DBL_HAS_QUIET_NAN__ 1 +// I386-LINUX:#define __DBL_MANT_DIG__ 53 +// I386-LINUX:#define __DBL_MAX_10_EXP__ 308 +// I386-LINUX:#define __DBL_MAX_EXP__ 1024 +// I386-LINUX:#define __DBL_MAX__ 1.7976931348623157e+308 +// I386-LINUX:#define __DBL_MIN_10_EXP__ (-307) +// I386-LINUX:#define __DBL_MIN_EXP__ (-1021) +// I386-LINUX:#define __DBL_MIN__ 2.2250738585072014e-308 +// I386-LINUX:#define __DECIMAL_DIG__ 21 +// I386-LINUX:#define __FLT_DENORM_MIN__ 1.40129846e-45F +// I386-LINUX:#define __FLT_DIG__ 6 +// I386-LINUX:#define __FLT_EPSILON__ 1.19209290e-7F +// I386-LINUX:#define __FLT_EVAL_METHOD__ 0 +// I386-LINUX:#define __FLT_HAS_DENORM__ 1 +// I386-LINUX:#define __FLT_HAS_INFINITY__ 1 +// I386-LINUX:#define __FLT_HAS_QUIET_NAN__ 1 +// I386-LINUX:#define __FLT_MANT_DIG__ 24 +// I386-LINUX:#define __FLT_MAX_10_EXP__ 38 +// I386-LINUX:#define __FLT_MAX_EXP__ 128 +// I386-LINUX:#define __FLT_MAX__ 3.40282347e+38F +// I386-LINUX:#define __FLT_MIN_10_EXP__ (-37) +// I386-LINUX:#define __FLT_MIN_EXP__ (-125) +// I386-LINUX:#define __FLT_MIN__ 1.17549435e-38F +// I386-LINUX:#define __FLT_RADIX__ 2 +// I386-LINUX:#define __INT16_TYPE__ short +// I386-LINUX:#define __INT32_TYPE__ int +// I386-LINUX:#define __INT64_C_SUFFIX__ LL +// I386-LINUX:#define __INT64_TYPE__ long long int +// I386-LINUX:#define __INT8_TYPE__ char +// I386-LINUX:#define __INTMAX_MAX__ 9223372036854775807LL +// I386-LINUX:#define __INTMAX_TYPE__ long long int +// I386-LINUX:#define __INTMAX_WIDTH__ 64 +// I386-LINUX:#define __INTPTR_TYPE__ int +// I386-LINUX:#define __INTPTR_WIDTH__ 32 +// I386-LINUX:#define __INT_MAX__ 2147483647 +// I386-LINUX:#define __LDBL_DENORM_MIN__ 3.64519953188247460253e-4951L +// I386-LINUX:#define __LDBL_DIG__ 18 +// I386-LINUX:#define __LDBL_EPSILON__ 1.08420217248550443401e-19L +// I386-LINUX:#define __LDBL_HAS_DENORM__ 1 +// I386-LINUX:#define __LDBL_HAS_INFINITY__ 1 +// I386-LINUX:#define __LDBL_HAS_QUIET_NAN__ 1 +// I386-LINUX:#define __LDBL_MANT_DIG__ 64 +// I386-LINUX:#define __LDBL_MAX_10_EXP__ 4932 +// I386-LINUX:#define __LDBL_MAX_EXP__ 16384 +// I386-LINUX:#define __LDBL_MAX__ 1.18973149535723176502e+4932L +// I386-LINUX:#define __LDBL_MIN_10_EXP__ (-4931) +// I386-LINUX:#define __LDBL_MIN_EXP__ (-16381) +// I386-LINUX:#define __LDBL_MIN__ 3.36210314311209350626e-4932L +// I386-LINUX:#define __LITTLE_ENDIAN__ 1 +// I386-LINUX:#define __LONG_LONG_MAX__ 9223372036854775807LL +// I386-LINUX:#define __LONG_MAX__ 2147483647L +// I386-LINUX:#define __NO_INLINE__ 1 +// I386-LINUX:#define __NO_MATH_INLINES 1 +// I386-LINUX:#define __POINTER_WIDTH__ 32 +// I386-LINUX:#define __PTRDIFF_TYPE__ int +// I386-LINUX:#define __PTRDIFF_WIDTH__ 32 +// I386-LINUX:#define __REGISTER_PREFIX__ +// I386-LINUX:#define __SCHAR_MAX__ 127 +// I386-LINUX:#define __SHRT_MAX__ 32767 +// I386-LINUX:#define __SIG_ATOMIC_WIDTH__ 32 +// I386-LINUX:#define __SIZEOF_DOUBLE__ 8 +// I386-LINUX:#define __SIZEOF_FLOAT__ 4 +// I386-LINUX:#define __SIZEOF_INT__ 4 +// I386-LINUX:#define __SIZEOF_LONG_DOUBLE__ 12 +// I386-LINUX:#define __SIZEOF_LONG_LONG__ 8 +// I386-LINUX:#define __SIZEOF_LONG__ 4 +// I386-LINUX:#define __SIZEOF_POINTER__ 4 +// I386-LINUX:#define __SIZEOF_PTRDIFF_T__ 4 +// I386-LINUX:#define __SIZEOF_SHORT__ 2 +// I386-LINUX:#define __SIZEOF_SIZE_T__ 4 +// I386-LINUX:#define __SIZEOF_WCHAR_T__ 4 +// I386-LINUX:#define __SIZEOF_WINT_T__ 4 +// I386-LINUX:#define __SIZE_TYPE__ unsigned int +// I386-LINUX:#define __SIZE_WIDTH__ 32 +// I386-LINUX:#define __UINTMAX_TYPE__ long long unsigned int +// I386-LINUX:#define __USER_LABEL_PREFIX__ +// I386-LINUX:#define __WCHAR_MAX__ 2147483647 +// I386-LINUX:#define __WCHAR_TYPE__ int +// I386-LINUX:#define __WCHAR_WIDTH__ 32 +// I386-LINUX:#define __WINT_TYPE__ unsigned int +// I386-LINUX:#define __WINT_WIDTH__ 32 +// I386-LINUX:#define __i386 1 +// I386-LINUX:#define __i386__ 1 +// I386-LINUX:#define i386 1 +// +// RUN: %clang_cc1 -E -dM -ffreestanding -triple=mips-none-none < /dev/null | FileCheck -check-prefix MIPS32BE %s +// +// MIPS32BE:#define MIPSEB 1 +// MIPS32BE:#define _ABIO32 1 +// MIPS32BE:#define _MIPSEB 1 +// MIPS32BE:#define _MIPS_SIM _ABIO32 +// MIPS32BE:#define _MIPS_SZINT 32 +// MIPS32BE:#define _MIPS_SZLONG 32 +// MIPS32BE:#define _MIPS_SZPTR 32 +// MIPS32BE:#define __CHAR16_TYPE__ unsigned short +// MIPS32BE:#define __CHAR32_TYPE__ unsigned int +// MIPS32BE:#define __CHAR_BIT__ 8 +// MIPS32BE:#define __CONSTANT_CFSTRINGS__ 1 +// MIPS32BE:#define __DBL_DENORM_MIN__ 4.9406564584124654e-324 +// MIPS32BE:#define __DBL_DIG__ 15 +// MIPS32BE:#define __DBL_EPSILON__ 2.2204460492503131e-16 +// MIPS32BE:#define __DBL_HAS_DENORM__ 1 +// MIPS32BE:#define __DBL_HAS_INFINITY__ 1 +// MIPS32BE:#define __DBL_HAS_QUIET_NAN__ 1 +// MIPS32BE:#define __DBL_MANT_DIG__ 53 +// MIPS32BE:#define __DBL_MAX_10_EXP__ 308 +// MIPS32BE:#define __DBL_MAX_EXP__ 1024 +// MIPS32BE:#define __DBL_MAX__ 1.7976931348623157e+308 +// MIPS32BE:#define __DBL_MIN_10_EXP__ (-307) +// MIPS32BE:#define __DBL_MIN_EXP__ (-1021) +// MIPS32BE:#define __DBL_MIN__ 2.2250738585072014e-308 +// MIPS32BE:#define __DECIMAL_DIG__ 17 +// MIPS32BE:#define __FLT_DENORM_MIN__ 1.40129846e-45F +// MIPS32BE:#define __FLT_DIG__ 6 +// MIPS32BE:#define __FLT_EPSILON__ 1.19209290e-7F +// MIPS32BE:#define __FLT_EVAL_METHOD__ 0 +// MIPS32BE:#define __FLT_HAS_DENORM__ 1 +// MIPS32BE:#define __FLT_HAS_INFINITY__ 1 +// MIPS32BE:#define __FLT_HAS_QUIET_NAN__ 1 +// MIPS32BE:#define __FLT_MANT_DIG__ 24 +// MIPS32BE:#define __FLT_MAX_10_EXP__ 38 +// MIPS32BE:#define __FLT_MAX_EXP__ 128 +// MIPS32BE:#define __FLT_MAX__ 3.40282347e+38F +// MIPS32BE:#define __FLT_MIN_10_EXP__ (-37) +// MIPS32BE:#define __FLT_MIN_EXP__ (-125) +// MIPS32BE:#define __FLT_MIN__ 1.17549435e-38F +// MIPS32BE:#define __FLT_RADIX__ 2 +// MIPS32BE:#define __INT16_TYPE__ short +// MIPS32BE:#define __INT32_TYPE__ int +// MIPS32BE:#define __INT64_C_SUFFIX__ LL +// MIPS32BE:#define __INT64_TYPE__ long long int +// MIPS32BE:#define __INT8_TYPE__ char +// MIPS32BE:#define __INTMAX_MAX__ 9223372036854775807LL +// MIPS32BE:#define __INTMAX_TYPE__ long long int +// MIPS32BE:#define __INTMAX_WIDTH__ 64 +// MIPS32BE:#define __INTPTR_TYPE__ long int +// MIPS32BE:#define __INTPTR_WIDTH__ 32 +// MIPS32BE:#define __INT_MAX__ 2147483647 +// MIPS32BE:#define __LDBL_DENORM_MIN__ 4.9406564584124654e-324 +// MIPS32BE:#define __LDBL_DIG__ 15 +// MIPS32BE:#define __LDBL_EPSILON__ 2.2204460492503131e-16 +// MIPS32BE:#define __LDBL_HAS_DENORM__ 1 +// MIPS32BE:#define __LDBL_HAS_INFINITY__ 1 +// MIPS32BE:#define __LDBL_HAS_QUIET_NAN__ 1 +// MIPS32BE:#define __LDBL_MANT_DIG__ 53 +// MIPS32BE:#define __LDBL_MAX_10_EXP__ 308 +// MIPS32BE:#define __LDBL_MAX_EXP__ 1024 +// MIPS32BE:#define __LDBL_MAX__ 1.7976931348623157e+308 +// MIPS32BE:#define __LDBL_MIN_10_EXP__ (-307) +// MIPS32BE:#define __LDBL_MIN_EXP__ (-1021) +// MIPS32BE:#define __LDBL_MIN__ 2.2250738585072014e-308 +// MIPS32BE:#define __LONG_LONG_MAX__ 9223372036854775807LL +// MIPS32BE:#define __LONG_MAX__ 2147483647L +// MIPS32BE:#define __MIPSEB 1 +// MIPS32BE:#define __MIPSEB__ 1 +// MIPS32BE:#define __NO_INLINE__ 1 +// MIPS32BE:#define __POINTER_WIDTH__ 32 +// MIPS32BE:#define __PRAGMA_REDEFINE_EXTNAME 1 +// MIPS32BE:#define __PTRDIFF_TYPE__ int +// MIPS32BE:#define __PTRDIFF_WIDTH__ 32 +// MIPS32BE:#define __REGISTER_PREFIX__ +// MIPS32BE:#define __SCHAR_MAX__ 127 +// MIPS32BE:#define __SHRT_MAX__ 32767 +// MIPS32BE:#define __SIG_ATOMIC_WIDTH__ 32 +// MIPS32BE:#define __SIZEOF_DOUBLE__ 8 +// MIPS32BE:#define __SIZEOF_FLOAT__ 4 +// MIPS32BE:#define __SIZEOF_INT__ 4 +// MIPS32BE:#define __SIZEOF_LONG_DOUBLE__ 8 +// MIPS32BE:#define __SIZEOF_LONG_LONG__ 8 +// MIPS32BE:#define __SIZEOF_LONG__ 4 +// MIPS32BE:#define __SIZEOF_POINTER__ 4 +// MIPS32BE:#define __SIZEOF_PTRDIFF_T__ 4 +// MIPS32BE:#define __SIZEOF_SHORT__ 2 +// MIPS32BE:#define __SIZEOF_SIZE_T__ 4 +// MIPS32BE:#define __SIZEOF_WCHAR_T__ 4 +// MIPS32BE:#define __SIZEOF_WINT_T__ 4 +// MIPS32BE:#define __SIZE_TYPE__ unsigned int +// MIPS32BE:#define __SIZE_WIDTH__ 32 +// MIPS32BE:#define __STDC_HOSTED__ 0 +// MIPS32BE:#define __STDC_VERSION__ 199901L +// MIPS32BE:#define __STDC__ 1 +// MIPS32BE:#define __UINTMAX_TYPE__ long long unsigned int +// MIPS32BE:#define __USER_LABEL_PREFIX__ _ +// MIPS32BE:#define __WCHAR_MAX__ 2147483647 +// MIPS32BE:#define __WCHAR_TYPE__ int +// MIPS32BE:#define __WCHAR_WIDTH__ 32 +// MIPS32BE:#define __WINT_TYPE__ int +// MIPS32BE:#define __WINT_WIDTH__ 32 +// MIPS32BE:#define __clang__ 1 +// MIPS32BE:#define __llvm__ 1 +// MIPS32BE:#define __mips 1 +// MIPS32BE:#define __mips__ 1 +// MIPS32BE:#define __mips_hard_float 1 +// MIPS32BE:#define __mips_o32 1 +// MIPS32BE:#define _mips 1 +// MIPS32BE:#define mips 1 +// +// RUN: %clang_cc1 -E -dM -ffreestanding -triple=mipsel-none-none < /dev/null | FileCheck -check-prefix MIPS32EL %s +// +// MIPS32EL:#define MIPSEL 1 +// MIPS32EL:#define _ABIO32 1 +// MIPS32EL:#define _MIPSEL 1 +// MIPS32EL:#define _MIPS_SIM _ABIO32 +// MIPS32EL:#define _MIPS_SZINT 32 +// MIPS32EL:#define _MIPS_SZLONG 32 +// MIPS32EL:#define _MIPS_SZPTR 32 +// MIPS32EL:#define __CHAR16_TYPE__ unsigned short +// MIPS32EL:#define __CHAR32_TYPE__ unsigned int +// MIPS32EL:#define __CHAR_BIT__ 8 +// MIPS32EL:#define __CONSTANT_CFSTRINGS__ 1 +// MIPS32EL:#define __DBL_DENORM_MIN__ 4.9406564584124654e-324 +// MIPS32EL:#define __DBL_DIG__ 15 +// MIPS32EL:#define __DBL_EPSILON__ 2.2204460492503131e-16 +// MIPS32EL:#define __DBL_HAS_DENORM__ 1 +// MIPS32EL:#define __DBL_HAS_INFINITY__ 1 +// MIPS32EL:#define __DBL_HAS_QUIET_NAN__ 1 +// MIPS32EL:#define __DBL_MANT_DIG__ 53 +// MIPS32EL:#define __DBL_MAX_10_EXP__ 308 +// MIPS32EL:#define __DBL_MAX_EXP__ 1024 +// MIPS32EL:#define __DBL_MAX__ 1.7976931348623157e+308 +// MIPS32EL:#define __DBL_MIN_10_EXP__ (-307) +// MIPS32EL:#define __DBL_MIN_EXP__ (-1021) +// MIPS32EL:#define __DBL_MIN__ 2.2250738585072014e-308 +// MIPS32EL:#define __DECIMAL_DIG__ 17 +// MIPS32EL:#define __FLT_DENORM_MIN__ 1.40129846e-45F +// MIPS32EL:#define __FLT_DIG__ 6 +// MIPS32EL:#define __FLT_EPSILON__ 1.19209290e-7F +// MIPS32EL:#define __FLT_EVAL_METHOD__ 0 +// MIPS32EL:#define __FLT_HAS_DENORM__ 1 +// MIPS32EL:#define __FLT_HAS_INFINITY__ 1 +// MIPS32EL:#define __FLT_HAS_QUIET_NAN__ 1 +// MIPS32EL:#define __FLT_MANT_DIG__ 24 +// MIPS32EL:#define __FLT_MAX_10_EXP__ 38 +// MIPS32EL:#define __FLT_MAX_EXP__ 128 +// MIPS32EL:#define __FLT_MAX__ 3.40282347e+38F +// MIPS32EL:#define __FLT_MIN_10_EXP__ (-37) +// MIPS32EL:#define __FLT_MIN_EXP__ (-125) +// MIPS32EL:#define __FLT_MIN__ 1.17549435e-38F +// MIPS32EL:#define __FLT_RADIX__ 2 +// MIPS32EL:#define __INT16_TYPE__ short +// MIPS32EL:#define __INT32_TYPE__ int +// MIPS32EL:#define __INT64_C_SUFFIX__ LL +// MIPS32EL:#define __INT64_TYPE__ long long int +// MIPS32EL:#define __INT8_TYPE__ char +// MIPS32EL:#define __INTMAX_MAX__ 9223372036854775807LL +// MIPS32EL:#define __INTMAX_TYPE__ long long int +// MIPS32EL:#define __INTMAX_WIDTH__ 64 +// MIPS32EL:#define __INTPTR_TYPE__ long int +// MIPS32EL:#define __INTPTR_WIDTH__ 32 +// MIPS32EL:#define __INT_MAX__ 2147483647 +// MIPS32EL:#define __LDBL_DENORM_MIN__ 4.9406564584124654e-324 +// MIPS32EL:#define __LDBL_DIG__ 15 +// MIPS32EL:#define __LDBL_EPSILON__ 2.2204460492503131e-16 +// MIPS32EL:#define __LDBL_HAS_DENORM__ 1 +// MIPS32EL:#define __LDBL_HAS_INFINITY__ 1 +// MIPS32EL:#define __LDBL_HAS_QUIET_NAN__ 1 +// MIPS32EL:#define __LDBL_MANT_DIG__ 53 +// MIPS32EL:#define __LDBL_MAX_10_EXP__ 308 +// MIPS32EL:#define __LDBL_MAX_EXP__ 1024 +// MIPS32EL:#define __LDBL_MAX__ 1.7976931348623157e+308 +// MIPS32EL:#define __LDBL_MIN_10_EXP__ (-307) +// MIPS32EL:#define __LDBL_MIN_EXP__ (-1021) +// MIPS32EL:#define __LDBL_MIN__ 2.2250738585072014e-308 +// MIPS32EL:#define __LONG_LONG_MAX__ 9223372036854775807LL +// MIPS32EL:#define __LONG_MAX__ 2147483647L +// MIPS32EL:#define __MIPSEL 1 +// MIPS32EL:#define __MIPSEL__ 1 +// MIPS32EL:#define __NO_INLINE__ 1 +// MIPS32EL:#define __POINTER_WIDTH__ 32 +// MIPS32EL:#define __PRAGMA_REDEFINE_EXTNAME 1 +// MIPS32EL:#define __PTRDIFF_TYPE__ int +// MIPS32EL:#define __PTRDIFF_WIDTH__ 32 +// MIPS32EL:#define __REGISTER_PREFIX__ +// MIPS32EL:#define __SCHAR_MAX__ 127 +// MIPS32EL:#define __SHRT_MAX__ 32767 +// MIPS32EL:#define __SIG_ATOMIC_WIDTH__ 32 +// MIPS32EL:#define __SIZEOF_DOUBLE__ 8 +// MIPS32EL:#define __SIZEOF_FLOAT__ 4 +// MIPS32EL:#define __SIZEOF_INT__ 4 +// MIPS32EL:#define __SIZEOF_LONG_DOUBLE__ 8 +// MIPS32EL:#define __SIZEOF_LONG_LONG__ 8 +// MIPS32EL:#define __SIZEOF_LONG__ 4 +// MIPS32EL:#define __SIZEOF_POINTER__ 4 +// MIPS32EL:#define __SIZEOF_PTRDIFF_T__ 4 +// MIPS32EL:#define __SIZEOF_SHORT__ 2 +// MIPS32EL:#define __SIZEOF_SIZE_T__ 4 +// MIPS32EL:#define __SIZEOF_WCHAR_T__ 4 +// MIPS32EL:#define __SIZEOF_WINT_T__ 4 +// MIPS32EL:#define __SIZE_TYPE__ unsigned int +// MIPS32EL:#define __SIZE_WIDTH__ 32 +// MIPS32EL:#define __UINTMAX_TYPE__ long long unsigned int +// MIPS32EL:#define __USER_LABEL_PREFIX__ _ +// MIPS32EL:#define __WCHAR_MAX__ 2147483647 +// MIPS32EL:#define __WCHAR_TYPE__ int +// MIPS32EL:#define __WCHAR_WIDTH__ 32 +// MIPS32EL:#define __WINT_TYPE__ int +// MIPS32EL:#define __WINT_WIDTH__ 32 +// MIPS32EL:#define __clang__ 1 +// MIPS32EL:#define __llvm__ 1 +// MIPS32EL:#define __mips 1 +// MIPS32EL:#define __mips__ 1 +// MIPS32EL:#define __mips_hard_float 1 +// MIPS32EL:#define __mips_o32 1 +// MIPS32EL:#define _mips 1 +// MIPS32EL:#define mips 1 +// +// RUN: %clang_cc1 -E -dM -ffreestanding -triple=mips64-none-none < /dev/null | FileCheck -check-prefix MIPS64BE %s +// +// MIPS64BE:#define MIPSEB 1 +// MIPS64BE:#define _ABI64 3 +// MIPS64BE:#define _MIPSEB 1 +// MIPS64BE:#define _MIPS_SIM _ABI64 +// MIPS64BE:#define _MIPS_SZINT 32 +// MIPS64BE:#define _MIPS_SZLONG 64 +// MIPS64BE:#define _MIPS_SZPTR 64 +// MIPS64BE:#define __CHAR16_TYPE__ unsigned short +// MIPS64BE:#define __CHAR32_TYPE__ unsigned int +// MIPS64BE:#define __CHAR_BIT__ 8 +// MIPS64BE:#define __CONSTANT_CFSTRINGS__ 1 +// MIPS64BE:#define __DBL_DENORM_MIN__ 4.9406564584124654e-324 +// MIPS64BE:#define __DBL_DIG__ 15 +// MIPS64BE:#define __DBL_EPSILON__ 2.2204460492503131e-16 +// MIPS64BE:#define __DBL_HAS_DENORM__ 1 +// MIPS64BE:#define __DBL_HAS_INFINITY__ 1 +// MIPS64BE:#define __DBL_HAS_QUIET_NAN__ 1 +// MIPS64BE:#define __DBL_MANT_DIG__ 53 +// MIPS64BE:#define __DBL_MAX_10_EXP__ 308 +// MIPS64BE:#define __DBL_MAX_EXP__ 1024 +// MIPS64BE:#define __DBL_MAX__ 1.7976931348623157e+308 +// MIPS64BE:#define __DBL_MIN_10_EXP__ (-307) +// MIPS64BE:#define __DBL_MIN_EXP__ (-1021) +// MIPS64BE:#define __DBL_MIN__ 2.2250738585072014e-308 +// MIPS64BE:#define __DECIMAL_DIG__ 36 +// MIPS64BE:#define __FLT_DENORM_MIN__ 1.40129846e-45F +// MIPS64BE:#define __FLT_DIG__ 6 +// MIPS64BE:#define __FLT_EPSILON__ 1.19209290e-7F +// MIPS64BE:#define __FLT_EVAL_METHOD__ 0 +// MIPS64BE:#define __FLT_HAS_DENORM__ 1 +// MIPS64BE:#define __FLT_HAS_INFINITY__ 1 +// MIPS64BE:#define __FLT_HAS_QUIET_NAN__ 1 +// MIPS64BE:#define __FLT_MANT_DIG__ 24 +// MIPS64BE:#define __FLT_MAX_10_EXP__ 38 +// MIPS64BE:#define __FLT_MAX_EXP__ 128 +// MIPS64BE:#define __FLT_MAX__ 3.40282347e+38F +// MIPS64BE:#define __FLT_MIN_10_EXP__ (-37) +// MIPS64BE:#define __FLT_MIN_EXP__ (-125) +// MIPS64BE:#define __FLT_MIN__ 1.17549435e-38F +// MIPS64BE:#define __FLT_RADIX__ 2 +// MIPS64BE:#define __INT16_TYPE__ short +// MIPS64BE:#define __INT32_TYPE__ int +// MIPS64BE:#define __INT64_C_SUFFIX__ LL +// MIPS64BE:#define __INT64_TYPE__ long long int +// MIPS64BE:#define __INT8_TYPE__ char +// MIPS64BE:#define __INTMAX_MAX__ 9223372036854775807LL +// MIPS64BE:#define __INTMAX_TYPE__ long long int +// MIPS64BE:#define __INTMAX_WIDTH__ 64 +// MIPS64BE:#define __INTPTR_TYPE__ long int +// MIPS64BE:#define __INTPTR_WIDTH__ 64 +// MIPS64BE:#define __INT_MAX__ 2147483647 +// MIPS64BE:#define __LDBL_DENORM_MIN__ 6.47517511943802511092443895822764655e-4966L +// MIPS64BE:#define __LDBL_DIG__ 33 +// MIPS64BE:#define __LDBL_EPSILON__ 1.92592994438723585305597794258492732e-34L +// MIPS64BE:#define __LDBL_HAS_DENORM__ 1 +// MIPS64BE:#define __LDBL_HAS_INFINITY__ 1 +// MIPS64BE:#define __LDBL_HAS_QUIET_NAN__ 1 +// MIPS64BE:#define __LDBL_MANT_DIG__ 113 +// MIPS64BE:#define __LDBL_MAX_10_EXP__ 4932 +// MIPS64BE:#define __LDBL_MAX_EXP__ 16384 +// MIPS64BE:#define __LDBL_MAX__ 1.18973149535723176508575932662800702e+4932L +// MIPS64BE:#define __LDBL_MIN_10_EXP__ (-4931) +// MIPS64BE:#define __LDBL_MIN_EXP__ (-16381) +// MIPS64BE:#define __LDBL_MIN__ 3.36210314311209350626267781732175260e-4932L +// MIPS64BE:#define __LONG_LONG_MAX__ 9223372036854775807LL +// MIPS64BE:#define __LONG_MAX__ 9223372036854775807L +// MIPS64BE:#define __MIPSEB 1 +// MIPS64BE:#define __MIPSEB__ 1 +// MIPS64BE:#define __NO_INLINE__ 1 +// MIPS64BE:#define __POINTER_WIDTH__ 64 +// MIPS64BE:#define __PRAGMA_REDEFINE_EXTNAME 1 +// MIPS64BE:#define __PTRDIFF_TYPE__ long int +// MIPS64BE:#define __PTRDIFF_WIDTH__ 64 +// MIPS64BE:#define __REGISTER_PREFIX__ +// MIPS64BE:#define __SCHAR_MAX__ 127 +// MIPS64BE:#define __SHRT_MAX__ 32767 +// MIPS64BE:#define __SIG_ATOMIC_WIDTH__ 32 +// MIPS64BE:#define __SIZEOF_DOUBLE__ 8 +// MIPS64BE:#define __SIZEOF_FLOAT__ 4 +// MIPS64BE:#define __SIZEOF_INT__ 4 +// MIPS64BE:#define __SIZEOF_LONG_DOUBLE__ 16 +// MIPS64BE:#define __SIZEOF_LONG_LONG__ 8 +// MIPS64BE:#define __SIZEOF_LONG__ 8 +// MIPS64BE:#define __SIZEOF_POINTER__ 8 +// MIPS64BE:#define __SIZEOF_PTRDIFF_T__ 8 +// MIPS64BE:#define __SIZEOF_SHORT__ 2 +// MIPS64BE:#define __SIZEOF_SIZE_T__ 8 +// MIPS64BE:#define __SIZEOF_WCHAR_T__ 4 +// MIPS64BE:#define __SIZEOF_WINT_T__ 4 +// MIPS64BE:#define __SIZE_TYPE__ long unsigned int +// MIPS64BE:#define __SIZE_WIDTH__ 64 +// MIPS64BE:#define __UINTMAX_TYPE__ long long unsigned int +// MIPS64BE:#define __USER_LABEL_PREFIX__ _ +// MIPS64BE:#define __WCHAR_MAX__ 2147483647 +// MIPS64BE:#define __WCHAR_TYPE__ int +// MIPS64BE:#define __WCHAR_WIDTH__ 32 +// MIPS64BE:#define __WINT_TYPE__ int +// MIPS64BE:#define __WINT_WIDTH__ 32 +// MIPS64BE:#define __clang__ 1 +// MIPS64BE:#define __llvm__ 1 +// MIPS64BE:#define __mips 1 +// MIPS64BE:#define __mips__ 1 +// MIPS64BE:#define __mips_hard_float 1 +// MIPS64BE:#define __mips_n64 1 +// MIPS64BE:#define _mips 1 +// MIPS64BE:#define mips 1 +// +// RUN: %clang_cc1 -E -dM -ffreestanding -triple=mips64el-none-none < /dev/null | FileCheck -check-prefix MIPS64EL %s +// +// MIPS64EL:#define MIPSEL 1 +// MIPS64EL:#define _ABI64 3 +// MIPS64EL:#define _MIPSEL 1 +// MIPS64EL:#define _MIPS_SIM _ABI64 +// MIPS64EL:#define _MIPS_SZINT 32 +// MIPS64EL:#define _MIPS_SZLONG 64 +// MIPS64EL:#define _MIPS_SZPTR 64 +// MIPS64EL:#define __CHAR16_TYPE__ unsigned short +// MIPS64EL:#define __CHAR32_TYPE__ unsigned int +// MIPS64EL:#define __CHAR_BIT__ 8 +// MIPS64EL:#define __CONSTANT_CFSTRINGS__ 1 +// MIPS64EL:#define __DBL_DENORM_MIN__ 4.9406564584124654e-324 +// MIPS64EL:#define __DBL_DIG__ 15 +// MIPS64EL:#define __DBL_EPSILON__ 2.2204460492503131e-16 +// MIPS64EL:#define __DBL_HAS_DENORM__ 1 +// MIPS64EL:#define __DBL_HAS_INFINITY__ 1 +// MIPS64EL:#define __DBL_HAS_QUIET_NAN__ 1 +// MIPS64EL:#define __DBL_MANT_DIG__ 53 +// MIPS64EL:#define __DBL_MAX_10_EXP__ 308 +// MIPS64EL:#define __DBL_MAX_EXP__ 1024 +// MIPS64EL:#define __DBL_MAX__ 1.7976931348623157e+308 +// MIPS64EL:#define __DBL_MIN_10_EXP__ (-307) +// MIPS64EL:#define __DBL_MIN_EXP__ (-1021) +// MIPS64EL:#define __DBL_MIN__ 2.2250738585072014e-308 +// MIPS64EL:#define __DECIMAL_DIG__ 36 +// MIPS64EL:#define __FLT_DENORM_MIN__ 1.40129846e-45F +// MIPS64EL:#define __FLT_DIG__ 6 +// MIPS64EL:#define __FLT_EPSILON__ 1.19209290e-7F +// MIPS64EL:#define __FLT_EVAL_METHOD__ 0 +// MIPS64EL:#define __FLT_HAS_DENORM__ 1 +// MIPS64EL:#define __FLT_HAS_INFINITY__ 1 +// MIPS64EL:#define __FLT_HAS_QUIET_NAN__ 1 +// MIPS64EL:#define __FLT_MANT_DIG__ 24 +// MIPS64EL:#define __FLT_MAX_10_EXP__ 38 +// MIPS64EL:#define __FLT_MAX_EXP__ 128 +// MIPS64EL:#define __FLT_MAX__ 3.40282347e+38F +// MIPS64EL:#define __FLT_MIN_10_EXP__ (-37) +// MIPS64EL:#define __FLT_MIN_EXP__ (-125) +// MIPS64EL:#define __FLT_MIN__ 1.17549435e-38F +// MIPS64EL:#define __FLT_RADIX__ 2 +// MIPS64EL:#define __INT16_TYPE__ short +// MIPS64EL:#define __INT32_TYPE__ int +// MIPS64EL:#define __INT64_C_SUFFIX__ LL +// MIPS64EL:#define __INT64_TYPE__ long long int +// MIPS64EL:#define __INT8_TYPE__ char +// MIPS64EL:#define __INTMAX_MAX__ 9223372036854775807LL +// MIPS64EL:#define __INTMAX_TYPE__ long long int +// MIPS64EL:#define __INTMAX_WIDTH__ 64 +// MIPS64EL:#define __INTPTR_TYPE__ long int +// MIPS64EL:#define __INTPTR_WIDTH__ 64 +// MIPS64EL:#define __INT_MAX__ 2147483647 +// MIPS64EL:#define __LDBL_DENORM_MIN__ 6.47517511943802511092443895822764655e-4966L +// MIPS64EL:#define __LDBL_DIG__ 33 +// MIPS64EL:#define __LDBL_EPSILON__ 1.92592994438723585305597794258492732e-34L +// MIPS64EL:#define __LDBL_HAS_DENORM__ 1 +// MIPS64EL:#define __LDBL_HAS_INFINITY__ 1 +// MIPS64EL:#define __LDBL_HAS_QUIET_NAN__ 1 +// MIPS64EL:#define __LDBL_MANT_DIG__ 113 +// MIPS64EL:#define __LDBL_MAX_10_EXP__ 4932 +// MIPS64EL:#define __LDBL_MAX_EXP__ 16384 +// MIPS64EL:#define __LDBL_MAX__ 1.18973149535723176508575932662800702e+4932L +// MIPS64EL:#define __LDBL_MIN_10_EXP__ (-4931) +// MIPS64EL:#define __LDBL_MIN_EXP__ (-16381) +// MIPS64EL:#define __LDBL_MIN__ 3.36210314311209350626267781732175260e-4932L +// MIPS64EL:#define __LONG_LONG_MAX__ 9223372036854775807LL +// MIPS64EL:#define __LONG_MAX__ 9223372036854775807L +// MIPS64EL:#define __MIPSEL 1 +// MIPS64EL:#define __MIPSEL__ 1 +// MIPS64EL:#define __NO_INLINE__ 1 +// MIPS64EL:#define __POINTER_WIDTH__ 64 +// MIPS64EL:#define __PRAGMA_REDEFINE_EXTNAME 1 +// MIPS64EL:#define __PTRDIFF_TYPE__ long int +// MIPS64EL:#define __PTRDIFF_WIDTH__ 64 +// MIPS64EL:#define __REGISTER_PREFIX__ +// MIPS64EL:#define __SCHAR_MAX__ 127 +// MIPS64EL:#define __SHRT_MAX__ 32767 +// MIPS64EL:#define __SIG_ATOMIC_WIDTH__ 32 +// MIPS64EL:#define __SIZEOF_DOUBLE__ 8 +// MIPS64EL:#define __SIZEOF_FLOAT__ 4 +// MIPS64EL:#define __SIZEOF_INT__ 4 +// MIPS64EL:#define __SIZEOF_LONG_DOUBLE__ 16 +// MIPS64EL:#define __SIZEOF_LONG_LONG__ 8 +// MIPS64EL:#define __SIZEOF_LONG__ 8 +// MIPS64EL:#define __SIZEOF_POINTER__ 8 +// MIPS64EL:#define __SIZEOF_PTRDIFF_T__ 8 +// MIPS64EL:#define __SIZEOF_SHORT__ 2 +// MIPS64EL:#define __SIZEOF_SIZE_T__ 8 +// MIPS64EL:#define __SIZEOF_WCHAR_T__ 4 +// MIPS64EL:#define __SIZEOF_WINT_T__ 4 +// MIPS64EL:#define __SIZE_TYPE__ long unsigned int +// MIPS64EL:#define __SIZE_WIDTH__ 64 +// MIPS64EL:#define __UINTMAX_TYPE__ long long unsigned int +// MIPS64EL:#define __USER_LABEL_PREFIX__ _ +// MIPS64EL:#define __WCHAR_MAX__ 2147483647 +// MIPS64EL:#define __WCHAR_TYPE__ int +// MIPS64EL:#define __WCHAR_WIDTH__ 32 +// MIPS64EL:#define __WINT_TYPE__ int +// MIPS64EL:#define __WINT_WIDTH__ 32 +// MIPS64EL:#define __clang__ 1 +// MIPS64EL:#define __llvm__ 1 +// MIPS64EL:#define __mips 1 +// MIPS64EL:#define __mips__ 1 +// MIPS64EL:#define __mips_hard_float 1 +// MIPS64EL:#define __mips_n64 1 +// MIPS64EL:#define _mips 1 +// MIPS64EL:#define mips 1 +// +// Check MIPS float ABI macros +// +// RUN: %clang_cc1 -E -dM -ffreestanding \ +// RUN: -triple=mips-none-none < /dev/null \ +// RUN: | FileCheck -check-prefix MIPS-FABI-HARD %s +// MIPS-FABI-HARD:#define __mips_hard_float 1 +// +// RUN: %clang_cc1 -target-feature +soft-float -E -dM -ffreestanding \ +// RUN: -triple=mips-none-none < /dev/null \ +// RUN: | FileCheck -check-prefix MIPS-FABI-SOFT %s +// MIPS-FABI-SOFT:#define __mips_soft_float 1 +// +// RUN: %clang_cc1 -target-feature +single-float -E -dM -ffreestanding \ +// RUN: -triple=mips-none-none < /dev/null \ +// RUN: | FileCheck -check-prefix MIPS-FABI-SINGLE %s +// MIPS-FABI-SINGLE:#define __mips_single_float 1 +// +// RUN: %clang_cc1 -E -dM -ffreestanding -triple=msp430-none-none < /dev/null | FileCheck -check-prefix MSP430 %s +// +// MSP430:#define MSP430 1 +// MSP430:#define __CHAR16_TYPE__ unsigned short +// MSP430:#define __CHAR32_TYPE__ unsigned int +// MSP430:#define __CHAR_BIT__ 8 +// MSP430:#define __DBL_DENORM_MIN__ 4.9406564584124654e-324 +// MSP430:#define __DBL_DIG__ 15 +// MSP430:#define __DBL_EPSILON__ 2.2204460492503131e-16 +// MSP430:#define __DBL_HAS_DENORM__ 1 +// MSP430:#define __DBL_HAS_INFINITY__ 1 +// MSP430:#define __DBL_HAS_QUIET_NAN__ 1 +// MSP430:#define __DBL_MANT_DIG__ 53 +// MSP430:#define __DBL_MAX_10_EXP__ 308 +// MSP430:#define __DBL_MAX_EXP__ 1024 +// MSP430:#define __DBL_MAX__ 1.7976931348623157e+308 +// MSP430:#define __DBL_MIN_10_EXP__ (-307) +// MSP430:#define __DBL_MIN_EXP__ (-1021) +// MSP430:#define __DBL_MIN__ 2.2250738585072014e-308 +// MSP430:#define __DECIMAL_DIG__ 17 +// MSP430:#define __FLT_DENORM_MIN__ 1.40129846e-45F +// MSP430:#define __FLT_DIG__ 6 +// MSP430:#define __FLT_EPSILON__ 1.19209290e-7F +// MSP430:#define __FLT_EVAL_METHOD__ 0 +// MSP430:#define __FLT_HAS_DENORM__ 1 +// MSP430:#define __FLT_HAS_INFINITY__ 1 +// MSP430:#define __FLT_HAS_QUIET_NAN__ 1 +// MSP430:#define __FLT_MANT_DIG__ 24 +// MSP430:#define __FLT_MAX_10_EXP__ 38 +// MSP430:#define __FLT_MAX_EXP__ 128 +// MSP430:#define __FLT_MAX__ 3.40282347e+38F +// MSP430:#define __FLT_MIN_10_EXP__ (-37) +// MSP430:#define __FLT_MIN_EXP__ (-125) +// MSP430:#define __FLT_MIN__ 1.17549435e-38F +// MSP430:#define __FLT_RADIX__ 2 +// MSP430:#define __INT16_TYPE__ short +// MSP430:#define __INT32_C_SUFFIX__ L +// MSP430:#define __INT32_TYPE__ long int +// MSP430:#define __INT8_TYPE__ char +// MSP430:#define __INTMAX_MAX__ 2147483647L +// MSP430:#define __INTMAX_TYPE__ long int +// MSP430:#define __INTMAX_WIDTH__ 32 +// MSP430:#define __INTPTR_TYPE__ short +// MSP430:#define __INTPTR_WIDTH__ 16 +// MSP430:#define __INT_MAX__ 32767 +// MSP430:#define __LDBL_DENORM_MIN__ 4.9406564584124654e-324 +// MSP430:#define __LDBL_DIG__ 15 +// MSP430:#define __LDBL_EPSILON__ 2.2204460492503131e-16 +// MSP430:#define __LDBL_HAS_DENORM__ 1 +// MSP430:#define __LDBL_HAS_INFINITY__ 1 +// MSP430:#define __LDBL_HAS_QUIET_NAN__ 1 +// MSP430:#define __LDBL_MANT_DIG__ 53 +// MSP430:#define __LDBL_MAX_10_EXP__ 308 +// MSP430:#define __LDBL_MAX_EXP__ 1024 +// MSP430:#define __LDBL_MAX__ 1.7976931348623157e+308 +// MSP430:#define __LDBL_MIN_10_EXP__ (-307) +// MSP430:#define __LDBL_MIN_EXP__ (-1021) +// MSP430:#define __LDBL_MIN__ 2.2250738585072014e-308 +// MSP430:#define __LONG_LONG_MAX__ 9223372036854775807LL +// MSP430:#define __LONG_MAX__ 2147483647L +// MSP430:#define __MSP430__ 1 +// MSP430:#define __NO_INLINE__ 1 +// MSP430:#define __POINTER_WIDTH__ 16 +// MSP430:#define __PTRDIFF_TYPE__ int +// MSP430:#define __PTRDIFF_WIDTH__ 16 +// MSP430:#define __SCHAR_MAX__ 127 +// MSP430:#define __SHRT_MAX__ 32767 +// MSP430:#define __SIG_ATOMIC_WIDTH__ 32 +// MSP430:#define __SIZEOF_DOUBLE__ 8 +// MSP430:#define __SIZEOF_FLOAT__ 4 +// MSP430:#define __SIZEOF_INT__ 2 +// MSP430:#define __SIZEOF_LONG_DOUBLE__ 8 +// MSP430:#define __SIZEOF_LONG_LONG__ 8 +// MSP430:#define __SIZEOF_LONG__ 4 +// MSP430:#define __SIZEOF_POINTER__ 2 +// MSP430:#define __SIZEOF_PTRDIFF_T__ 2 +// MSP430:#define __SIZEOF_SHORT__ 2 +// MSP430:#define __SIZEOF_SIZE_T__ 2 +// MSP430:#define __SIZEOF_WCHAR_T__ 2 +// MSP430:#define __SIZEOF_WINT_T__ 2 +// MSP430:#define __SIZE_TYPE__ unsigned int +// MSP430:#define __SIZE_WIDTH__ 16 +// MSP430:#define __UINTMAX_TYPE__ long unsigned int +// MSP430:#define __USER_LABEL_PREFIX__ _ +// MSP430:#define __WCHAR_MAX__ 32767 +// MSP430:#define __WCHAR_TYPE__ int +// MSP430:#define __WCHAR_WIDTH__ 16 +// MSP430:#define __WINT_TYPE__ int +// MSP430:#define __WINT_WIDTH__ 16 +// MSP430:#define __clang__ 1 +// +// RUN: %clang_cc1 -E -dM -ffreestanding -triple=powerpc64-none-none -fno-signed-char < /dev/null | FileCheck -check-prefix PPC64 %s +// +// PPC64:#define _ARCH_PPC 1 +// PPC64:#define _ARCH_PPC64 1 +// PPC64:#define _BIG_ENDIAN 1 +// PPC64:#define _LP64 1 +// PPC64:#define __BIG_ENDIAN__ 1 +// PPC64:#define __CHAR16_TYPE__ unsigned short +// PPC64:#define __CHAR32_TYPE__ unsigned int +// PPC64:#define __CHAR_BIT__ 8 +// PPC64:#define __CHAR_UNSIGNED__ 1 +// PPC64:#define __DBL_DENORM_MIN__ 4.9406564584124654e-324 +// PPC64:#define __DBL_DIG__ 15 +// PPC64:#define __DBL_EPSILON__ 2.2204460492503131e-16 +// PPC64:#define __DBL_HAS_DENORM__ 1 +// PPC64:#define __DBL_HAS_INFINITY__ 1 +// PPC64:#define __DBL_HAS_QUIET_NAN__ 1 +// PPC64:#define __DBL_MANT_DIG__ 53 +// PPC64:#define __DBL_MAX_10_EXP__ 308 +// PPC64:#define __DBL_MAX_EXP__ 1024 +// PPC64:#define __DBL_MAX__ 1.7976931348623157e+308 +// PPC64:#define __DBL_MIN_10_EXP__ (-307) +// PPC64:#define __DBL_MIN_EXP__ (-1021) +// PPC64:#define __DBL_MIN__ 2.2250738585072014e-308 +// PPC64:#define __DECIMAL_DIG__ 33 +// PPC64:#define __FLT_DENORM_MIN__ 1.40129846e-45F +// PPC64:#define __FLT_DIG__ 6 +// PPC64:#define __FLT_EPSILON__ 1.19209290e-7F +// PPC64:#define __FLT_EVAL_METHOD__ 0 +// PPC64:#define __FLT_HAS_DENORM__ 1 +// PPC64:#define __FLT_HAS_INFINITY__ 1 +// PPC64:#define __FLT_HAS_QUIET_NAN__ 1 +// PPC64:#define __FLT_MANT_DIG__ 24 +// PPC64:#define __FLT_MAX_10_EXP__ 38 +// PPC64:#define __FLT_MAX_EXP__ 128 +// PPC64:#define __FLT_MAX__ 3.40282347e+38F +// PPC64:#define __FLT_MIN_10_EXP__ (-37) +// PPC64:#define __FLT_MIN_EXP__ (-125) +// PPC64:#define __FLT_MIN__ 1.17549435e-38F +// PPC64:#define __FLT_RADIX__ 2 +// PPC64:#define __INT16_TYPE__ short +// PPC64:#define __INT32_TYPE__ int +// PPC64:#define __INT64_C_SUFFIX__ L +// PPC64:#define __INT64_TYPE__ long int +// PPC64:#define __INT8_TYPE__ char +// PPC64:#define __INTMAX_MAX__ 9223372036854775807L +// PPC64:#define __INTMAX_TYPE__ long int +// PPC64:#define __INTMAX_WIDTH__ 64 +// PPC64:#define __INTPTR_TYPE__ long int +// PPC64:#define __INTPTR_WIDTH__ 64 +// PPC64:#define __INT_MAX__ 2147483647 +// PPC64:#define __LDBL_DENORM_MIN__ 4.94065645841246544176568792868221e-324L +// PPC64:#define __LDBL_DIG__ 31 +// PPC64:#define __LDBL_EPSILON__ 4.94065645841246544176568792868221e-324L +// PPC64:#define __LDBL_HAS_DENORM__ 1 +// PPC64:#define __LDBL_HAS_INFINITY__ 1 +// PPC64:#define __LDBL_HAS_QUIET_NAN__ 1 +// PPC64:#define __LDBL_MANT_DIG__ 106 +// PPC64:#define __LDBL_MAX_10_EXP__ 308 +// PPC64:#define __LDBL_MAX_EXP__ 1024 +// PPC64:#define __LDBL_MAX__ 1.79769313486231580793728971405301e+308L +// PPC64:#define __LDBL_MIN_10_EXP__ (-291) +// PPC64:#define __LDBL_MIN_EXP__ (-968) +// PPC64:#define __LDBL_MIN__ 2.00416836000897277799610805135016e-292L +// PPC64:#define __LONG_DOUBLE_128__ 1 +// PPC64:#define __LONG_LONG_MAX__ 9223372036854775807LL +// PPC64:#define __LONG_MAX__ 9223372036854775807L +// PPC64:#define __LP64__ 1 +// PPC64:#define __NATURAL_ALIGNMENT__ 1 +// PPC64:#define __NO_INLINE__ 1 +// PPC64:#define __POINTER_WIDTH__ 64 +// PPC64:#define __POWERPC__ 1 +// PPC64:#define __PTRDIFF_TYPE__ long int +// PPC64:#define __PTRDIFF_WIDTH__ 64 +// PPC64:#define __REGISTER_PREFIX__ +// PPC64:#define __SCHAR_MAX__ 127 +// PPC64:#define __SHRT_MAX__ 32767 +// PPC64:#define __SIG_ATOMIC_WIDTH__ 32 +// PPC64:#define __SIZEOF_DOUBLE__ 8 +// PPC64:#define __SIZEOF_FLOAT__ 4 +// PPC64:#define __SIZEOF_INT__ 4 +// PPC64:#define __SIZEOF_LONG_DOUBLE__ 16 +// PPC64:#define __SIZEOF_LONG_LONG__ 8 +// PPC64:#define __SIZEOF_LONG__ 8 +// PPC64:#define __SIZEOF_POINTER__ 8 +// PPC64:#define __SIZEOF_PTRDIFF_T__ 8 +// PPC64:#define __SIZEOF_SHORT__ 2 +// PPC64:#define __SIZEOF_SIZE_T__ 8 +// PPC64:#define __SIZEOF_WCHAR_T__ 4 +// PPC64:#define __SIZEOF_WINT_T__ 4 +// PPC64:#define __SIZE_TYPE__ long unsigned int +// PPC64:#define __SIZE_WIDTH__ 64 +// PPC64:#define __UINTMAX_TYPE__ long unsigned int +// PPC64:#define __USER_LABEL_PREFIX__ _ +// PPC64:#define __WCHAR_MAX__ 2147483647 +// PPC64:#define __WCHAR_TYPE__ int +// PPC64:#define __WCHAR_WIDTH__ 32 +// PPC64:#define __WINT_TYPE__ int +// PPC64:#define __WINT_WIDTH__ 32 +// PPC64:#define __ppc64__ 1 +// PPC64:#define __ppc__ 1 +// +// RUN: %clang_cc1 -E -dM -ffreestanding -triple=powerpc64-unknown-linux-gnu -fno-signed-char < /dev/null | FileCheck -check-prefix PPC64-LINUX %s +// +// PPC64-LINUX:#define _ARCH_PPC 1 +// PPC64-LINUX:#define _ARCH_PPC64 1 +// PPC64-LINUX:#define _BIG_ENDIAN 1 +// PPC64-LINUX:#define _LP64 1 +// PPC64-LINUX:#define __BIG_ENDIAN__ 1 +// PPC64-LINUX:#define __CHAR16_TYPE__ unsigned short +// PPC64-LINUX:#define __CHAR32_TYPE__ unsigned int +// PPC64-LINUX:#define __CHAR_BIT__ 8 +// PPC64-LINUX:#define __CHAR_UNSIGNED__ 1 +// PPC64-LINUX:#define __DBL_DENORM_MIN__ 4.9406564584124654e-324 +// PPC64-LINUX:#define __DBL_DIG__ 15 +// PPC64-LINUX:#define __DBL_EPSILON__ 2.2204460492503131e-16 +// PPC64-LINUX:#define __DBL_HAS_DENORM__ 1 +// PPC64-LINUX:#define __DBL_HAS_INFINITY__ 1 +// PPC64-LINUX:#define __DBL_HAS_QUIET_NAN__ 1 +// PPC64-LINUX:#define __DBL_MANT_DIG__ 53 +// PPC64-LINUX:#define __DBL_MAX_10_EXP__ 308 +// PPC64-LINUX:#define __DBL_MAX_EXP__ 1024 +// PPC64-LINUX:#define __DBL_MAX__ 1.7976931348623157e+308 +// PPC64-LINUX:#define __DBL_MIN_10_EXP__ (-307) +// PPC64-LINUX:#define __DBL_MIN_EXP__ (-1021) +// PPC64-LINUX:#define __DBL_MIN__ 2.2250738585072014e-308 +// PPC64-LINUX:#define __DECIMAL_DIG__ 33 +// PPC64-LINUX:#define __FLT_DENORM_MIN__ 1.40129846e-45F +// PPC64-LINUX:#define __FLT_DIG__ 6 +// PPC64-LINUX:#define __FLT_EPSILON__ 1.19209290e-7F +// PPC64-LINUX:#define __FLT_EVAL_METHOD__ 0 +// PPC64-LINUX:#define __FLT_HAS_DENORM__ 1 +// PPC64-LINUX:#define __FLT_HAS_INFINITY__ 1 +// PPC64-LINUX:#define __FLT_HAS_QUIET_NAN__ 1 +// PPC64-LINUX:#define __FLT_MANT_DIG__ 24 +// PPC64-LINUX:#define __FLT_MAX_10_EXP__ 38 +// PPC64-LINUX:#define __FLT_MAX_EXP__ 128 +// PPC64-LINUX:#define __FLT_MAX__ 3.40282347e+38F +// PPC64-LINUX:#define __FLT_MIN_10_EXP__ (-37) +// PPC64-LINUX:#define __FLT_MIN_EXP__ (-125) +// PPC64-LINUX:#define __FLT_MIN__ 1.17549435e-38F +// PPC64-LINUX:#define __FLT_RADIX__ 2 +// PPC64-LINUX:#define __INT16_TYPE__ short +// PPC64-LINUX:#define __INT32_TYPE__ int +// PPC64-LINUX:#define __INT64_C_SUFFIX__ L +// PPC64-LINUX:#define __INT64_TYPE__ long int +// PPC64-LINUX:#define __INT8_TYPE__ char +// PPC64-LINUX:#define __INTMAX_MAX__ 9223372036854775807L +// PPC64-LINUX:#define __INTMAX_TYPE__ long int +// PPC64-LINUX:#define __INTMAX_WIDTH__ 64 +// PPC64-LINUX:#define __INTPTR_TYPE__ long int +// PPC64-LINUX:#define __INTPTR_WIDTH__ 64 +// PPC64-LINUX:#define __INT_MAX__ 2147483647 +// PPC64-LINUX:#define __LDBL_DENORM_MIN__ 4.94065645841246544176568792868221e-324L +// PPC64-LINUX:#define __LDBL_DIG__ 31 +// PPC64-LINUX:#define __LDBL_EPSILON__ 4.94065645841246544176568792868221e-324L +// PPC64-LINUX:#define __LDBL_HAS_DENORM__ 1 +// PPC64-LINUX:#define __LDBL_HAS_INFINITY__ 1 +// PPC64-LINUX:#define __LDBL_HAS_QUIET_NAN__ 1 +// PPC64-LINUX:#define __LDBL_MANT_DIG__ 106 +// PPC64-LINUX:#define __LDBL_MAX_10_EXP__ 308 +// PPC64-LINUX:#define __LDBL_MAX_EXP__ 1024 +// PPC64-LINUX:#define __LDBL_MAX__ 1.79769313486231580793728971405301e+308L +// PPC64-LINUX:#define __LDBL_MIN_10_EXP__ (-291) +// PPC64-LINUX:#define __LDBL_MIN_EXP__ (-968) +// PPC64-LINUX:#define __LDBL_MIN__ 2.00416836000897277799610805135016e-292L +// PPC64-LINUX:#define __LONG_DOUBLE_128__ 1 +// PPC64-LINUX:#define __LONG_LONG_MAX__ 9223372036854775807LL +// PPC64-LINUX:#define __LONG_MAX__ 9223372036854775807L +// PPC64-LINUX:#define __LP64__ 1 +// PPC64-LINUX:#define __NATURAL_ALIGNMENT__ 1 +// PPC64-LINUX:#define __NO_INLINE__ 1 +// PPC64-LINUX:#define __POINTER_WIDTH__ 64 +// PPC64-LINUX:#define __POWERPC__ 1 +// PPC64-LINUX:#define __PTRDIFF_TYPE__ long int +// PPC64-LINUX:#define __PTRDIFF_WIDTH__ 64 +// PPC64-LINUX:#define __REGISTER_PREFIX__ +// PPC64-LINUX:#define __SCHAR_MAX__ 127 +// PPC64-LINUX:#define __SHRT_MAX__ 32767 +// PPC64-LINUX:#define __SIG_ATOMIC_WIDTH__ 32 +// PPC64-LINUX:#define __SIZEOF_DOUBLE__ 8 +// PPC64-LINUX:#define __SIZEOF_FLOAT__ 4 +// PPC64-LINUX:#define __SIZEOF_INT__ 4 +// PPC64-LINUX:#define __SIZEOF_LONG_DOUBLE__ 16 +// PPC64-LINUX:#define __SIZEOF_LONG_LONG__ 8 +// PPC64-LINUX:#define __SIZEOF_LONG__ 8 +// PPC64-LINUX:#define __SIZEOF_POINTER__ 8 +// PPC64-LINUX:#define __SIZEOF_PTRDIFF_T__ 8 +// PPC64-LINUX:#define __SIZEOF_SHORT__ 2 +// PPC64-LINUX:#define __SIZEOF_SIZE_T__ 8 +// PPC64-LINUX:#define __SIZEOF_WCHAR_T__ 4 +// PPC64-LINUX:#define __SIZEOF_WINT_T__ 4 +// PPC64-LINUX:#define __SIZE_TYPE__ long unsigned int +// PPC64-LINUX:#define __SIZE_WIDTH__ 64 +// PPC64-LINUX:#define __UINTMAX_TYPE__ long unsigned int +// PPC64-LINUX:#define __USER_LABEL_PREFIX__ +// PPC64-LINUX:#define __WCHAR_MAX__ 2147483647 +// PPC64-LINUX:#define __WCHAR_TYPE__ int +// PPC64-LINUX:#define __WCHAR_WIDTH__ 32 +// PPC64-LINUX:#define __WINT_TYPE__ unsigned int +// PPC64-LINUX:#define __WINT_UNSIGNED__ 1 +// PPC64-LINUX:#define __WINT_WIDTH__ 32 +// PPC64-LINUX:#define __powerpc64__ 1 +// PPC64-LINUX:#define __powerpc__ 1 +// PPC64-LINUX:#define __ppc64__ 1 +// PPC64-LINUX:#define __ppc__ 1 +// +// RUN: %clang_cc1 -E -dM -ffreestanding -triple=powerpc-none-none -fno-signed-char < /dev/null | FileCheck -check-prefix PPC %s +// +// PPC:#define _ARCH_PPC 1 +// PPC:#define _BIG_ENDIAN 1 +// PPC:#define __BIG_ENDIAN__ 1 +// PPC:#define __CHAR16_TYPE__ unsigned short +// PPC:#define __CHAR32_TYPE__ unsigned int +// PPC:#define __CHAR_BIT__ 8 +// PPC:#define __CHAR_UNSIGNED__ 1 +// PPC:#define __DBL_DENORM_MIN__ 4.9406564584124654e-324 +// PPC:#define __DBL_DIG__ 15 +// PPC:#define __DBL_EPSILON__ 2.2204460492503131e-16 +// PPC:#define __DBL_HAS_DENORM__ 1 +// PPC:#define __DBL_HAS_INFINITY__ 1 +// PPC:#define __DBL_HAS_QUIET_NAN__ 1 +// PPC:#define __DBL_MANT_DIG__ 53 +// PPC:#define __DBL_MAX_10_EXP__ 308 +// PPC:#define __DBL_MAX_EXP__ 1024 +// PPC:#define __DBL_MAX__ 1.7976931348623157e+308 +// PPC:#define __DBL_MIN_10_EXP__ (-307) +// PPC:#define __DBL_MIN_EXP__ (-1021) +// PPC:#define __DBL_MIN__ 2.2250738585072014e-308 +// PPC:#define __DECIMAL_DIG__ 33 +// PPC:#define __FLT_DENORM_MIN__ 1.40129846e-45F +// PPC:#define __FLT_DIG__ 6 +// PPC:#define __FLT_EPSILON__ 1.19209290e-7F +// PPC:#define __FLT_EVAL_METHOD__ 0 +// PPC:#define __FLT_HAS_DENORM__ 1 +// PPC:#define __FLT_HAS_INFINITY__ 1 +// PPC:#define __FLT_HAS_QUIET_NAN__ 1 +// PPC:#define __FLT_MANT_DIG__ 24 +// PPC:#define __FLT_MAX_10_EXP__ 38 +// PPC:#define __FLT_MAX_EXP__ 128 +// PPC:#define __FLT_MAX__ 3.40282347e+38F +// PPC:#define __FLT_MIN_10_EXP__ (-37) +// PPC:#define __FLT_MIN_EXP__ (-125) +// PPC:#define __FLT_MIN__ 1.17549435e-38F +// PPC:#define __FLT_RADIX__ 2 +// PPC:#define __INT16_TYPE__ short +// PPC:#define __INT32_TYPE__ int +// PPC:#define __INT64_C_SUFFIX__ LL +// PPC:#define __INT64_TYPE__ long long int +// PPC:#define __INT8_TYPE__ char +// PPC:#define __INTMAX_MAX__ 9223372036854775807LL +// PPC:#define __INTMAX_TYPE__ long long int +// PPC:#define __INTMAX_WIDTH__ 64 +// PPC:#define __INTPTR_TYPE__ long int +// PPC:#define __INTPTR_WIDTH__ 32 +// PPC:#define __INT_MAX__ 2147483647 +// PPC:#define __LDBL_DENORM_MIN__ 4.94065645841246544176568792868221e-324L +// PPC:#define __LDBL_DIG__ 31 +// PPC:#define __LDBL_EPSILON__ 4.94065645841246544176568792868221e-324L +// PPC:#define __LDBL_HAS_DENORM__ 1 +// PPC:#define __LDBL_HAS_INFINITY__ 1 +// PPC:#define __LDBL_HAS_QUIET_NAN__ 1 +// PPC:#define __LDBL_MANT_DIG__ 106 +// PPC:#define __LDBL_MAX_10_EXP__ 308 +// PPC:#define __LDBL_MAX_EXP__ 1024 +// PPC:#define __LDBL_MAX__ 1.79769313486231580793728971405301e+308L +// PPC:#define __LDBL_MIN_10_EXP__ (-291) +// PPC:#define __LDBL_MIN_EXP__ (-968) +// PPC:#define __LDBL_MIN__ 2.00416836000897277799610805135016e-292L +// PPC:#define __LONG_DOUBLE_128__ 1 +// PPC:#define __LONG_LONG_MAX__ 9223372036854775807LL +// PPC:#define __LONG_MAX__ 2147483647L +// PPC:#define __NATURAL_ALIGNMENT__ 1 +// PPC:#define __NO_INLINE__ 1 +// PPC:#define __POINTER_WIDTH__ 32 +// PPC:#define __POWERPC__ 1 +// PPC:#define __PTRDIFF_TYPE__ long int +// PPC:#define __PTRDIFF_WIDTH__ 32 +// PPC:#define __REGISTER_PREFIX__ +// PPC:#define __SCHAR_MAX__ 127 +// PPC:#define __SHRT_MAX__ 32767 +// PPC:#define __SIG_ATOMIC_WIDTH__ 32 +// PPC:#define __SIZEOF_DOUBLE__ 8 +// PPC:#define __SIZEOF_FLOAT__ 4 +// PPC:#define __SIZEOF_INT__ 4 +// PPC:#define __SIZEOF_LONG_DOUBLE__ 16 +// PPC:#define __SIZEOF_LONG_LONG__ 8 +// PPC:#define __SIZEOF_LONG__ 4 +// PPC:#define __SIZEOF_POINTER__ 4 +// PPC:#define __SIZEOF_PTRDIFF_T__ 4 +// PPC:#define __SIZEOF_SHORT__ 2 +// PPC:#define __SIZEOF_SIZE_T__ 4 +// PPC:#define __SIZEOF_WCHAR_T__ 4 +// PPC:#define __SIZEOF_WINT_T__ 4 +// PPC:#define __SIZE_TYPE__ long unsigned int +// PPC:#define __SIZE_WIDTH__ 32 +// PPC:#define __UINTMAX_TYPE__ long long unsigned int +// PPC:#define __USER_LABEL_PREFIX__ _ +// PPC:#define __WCHAR_MAX__ 2147483647 +// PPC:#define __WCHAR_TYPE__ int +// PPC:#define __WCHAR_WIDTH__ 32 +// PPC:#define __WINT_TYPE__ int +// PPC:#define __WINT_WIDTH__ 32 +// PPC:#define __ppc__ 1 +// +// RUN: %clang_cc1 -E -dM -ffreestanding -triple=powerpc-unknown-linux-gnu -fno-signed-char < /dev/null | FileCheck -check-prefix PPC-LINUX %s +// +// PPC-LINUX:#define _ARCH_PPC 1 +// PPC-LINUX:#define _BIG_ENDIAN 1 +// PPC-LINUX:#define __BIG_ENDIAN__ 1 +// PPC-LINUX:#define __CHAR16_TYPE__ unsigned short +// PPC-LINUX:#define __CHAR32_TYPE__ unsigned int +// PPC-LINUX:#define __CHAR_BIT__ 8 +// PPC-LINUX:#define __CHAR_UNSIGNED__ 1 +// PPC-LINUX:#define __DBL_DENORM_MIN__ 4.9406564584124654e-324 +// PPC-LINUX:#define __DBL_DIG__ 15 +// PPC-LINUX:#define __DBL_EPSILON__ 2.2204460492503131e-16 +// PPC-LINUX:#define __DBL_HAS_DENORM__ 1 +// PPC-LINUX:#define __DBL_HAS_INFINITY__ 1 +// PPC-LINUX:#define __DBL_HAS_QUIET_NAN__ 1 +// PPC-LINUX:#define __DBL_MANT_DIG__ 53 +// PPC-LINUX:#define __DBL_MAX_10_EXP__ 308 +// PPC-LINUX:#define __DBL_MAX_EXP__ 1024 +// PPC-LINUX:#define __DBL_MAX__ 1.7976931348623157e+308 +// PPC-LINUX:#define __DBL_MIN_10_EXP__ (-307) +// PPC-LINUX:#define __DBL_MIN_EXP__ (-1021) +// PPC-LINUX:#define __DBL_MIN__ 2.2250738585072014e-308 +// PPC-LINUX:#define __DECIMAL_DIG__ 33 +// PPC-LINUX:#define __FLT_DENORM_MIN__ 1.40129846e-45F +// PPC-LINUX:#define __FLT_DIG__ 6 +// PPC-LINUX:#define __FLT_EPSILON__ 1.19209290e-7F +// PPC-LINUX:#define __FLT_EVAL_METHOD__ 0 +// PPC-LINUX:#define __FLT_HAS_DENORM__ 1 +// PPC-LINUX:#define __FLT_HAS_INFINITY__ 1 +// PPC-LINUX:#define __FLT_HAS_QUIET_NAN__ 1 +// PPC-LINUX:#define __FLT_MANT_DIG__ 24 +// PPC-LINUX:#define __FLT_MAX_10_EXP__ 38 +// PPC-LINUX:#define __FLT_MAX_EXP__ 128 +// PPC-LINUX:#define __FLT_MAX__ 3.40282347e+38F +// PPC-LINUX:#define __FLT_MIN_10_EXP__ (-37) +// PPC-LINUX:#define __FLT_MIN_EXP__ (-125) +// PPC-LINUX:#define __FLT_MIN__ 1.17549435e-38F +// PPC-LINUX:#define __FLT_RADIX__ 2 +// PPC-LINUX:#define __INT16_TYPE__ short +// PPC-LINUX:#define __INT32_TYPE__ int +// PPC-LINUX:#define __INT64_C_SUFFIX__ LL +// PPC-LINUX:#define __INT64_TYPE__ long long int +// PPC-LINUX:#define __INT8_TYPE__ char +// PPC-LINUX:#define __INTMAX_MAX__ 9223372036854775807LL +// PPC-LINUX:#define __INTMAX_TYPE__ long long int +// PPC-LINUX:#define __INTMAX_WIDTH__ 64 +// PPC-LINUX:#define __INTPTR_TYPE__ int +// PPC-LINUX:#define __INTPTR_WIDTH__ 32 +// PPC-LINUX:#define __INT_MAX__ 2147483647 +// PPC-LINUX:#define __LDBL_DENORM_MIN__ 4.94065645841246544176568792868221e-324L +// PPC-LINUX:#define __LDBL_DIG__ 31 +// PPC-LINUX:#define __LDBL_EPSILON__ 4.94065645841246544176568792868221e-324L +// PPC-LINUX:#define __LDBL_HAS_DENORM__ 1 +// PPC-LINUX:#define __LDBL_HAS_INFINITY__ 1 +// PPC-LINUX:#define __LDBL_HAS_QUIET_NAN__ 1 +// PPC-LINUX:#define __LDBL_MANT_DIG__ 106 +// PPC-LINUX:#define __LDBL_MAX_10_EXP__ 308 +// PPC-LINUX:#define __LDBL_MAX_EXP__ 1024 +// PPC-LINUX:#define __LDBL_MAX__ 1.79769313486231580793728971405301e+308L +// PPC-LINUX:#define __LDBL_MIN_10_EXP__ (-291) +// PPC-LINUX:#define __LDBL_MIN_EXP__ (-968) +// PPC-LINUX:#define __LDBL_MIN__ 2.00416836000897277799610805135016e-292L +// PPC-LINUX:#define __LONG_DOUBLE_128__ 1 +// PPC-LINUX:#define __LONG_LONG_MAX__ 9223372036854775807LL +// PPC-LINUX:#define __LONG_MAX__ 2147483647L +// PPC-LINUX:#define __NATURAL_ALIGNMENT__ 1 +// PPC-LINUX:#define __NO_INLINE__ 1 +// PPC-LINUX:#define __POINTER_WIDTH__ 32 +// PPC-LINUX:#define __POWERPC__ 1 +// PPC-LINUX:#define __PTRDIFF_TYPE__ int +// PPC-LINUX:#define __PTRDIFF_WIDTH__ 32 +// PPC-LINUX:#define __REGISTER_PREFIX__ +// PPC-LINUX:#define __SCHAR_MAX__ 127 +// PPC-LINUX:#define __SHRT_MAX__ 32767 +// PPC-LINUX:#define __SIG_ATOMIC_WIDTH__ 32 +// PPC-LINUX:#define __SIZEOF_DOUBLE__ 8 +// PPC-LINUX:#define __SIZEOF_FLOAT__ 4 +// PPC-LINUX:#define __SIZEOF_INT__ 4 +// PPC-LINUX:#define __SIZEOF_LONG_DOUBLE__ 16 +// PPC-LINUX:#define __SIZEOF_LONG_LONG__ 8 +// PPC-LINUX:#define __SIZEOF_LONG__ 4 +// PPC-LINUX:#define __SIZEOF_POINTER__ 4 +// PPC-LINUX:#define __SIZEOF_PTRDIFF_T__ 4 +// PPC-LINUX:#define __SIZEOF_SHORT__ 2 +// PPC-LINUX:#define __SIZEOF_SIZE_T__ 4 +// PPC-LINUX:#define __SIZEOF_WCHAR_T__ 4 +// PPC-LINUX:#define __SIZEOF_WINT_T__ 4 +// PPC-LINUX:#define __SIZE_TYPE__ unsigned int +// PPC-LINUX:#define __SIZE_WIDTH__ 32 +// PPC-LINUX:#define __UINTMAX_TYPE__ long long unsigned int +// PPC-LINUX:#define __USER_LABEL_PREFIX__ +// PPC-LINUX:#define __WCHAR_MAX__ 2147483647 +// PPC-LINUX:#define __WCHAR_TYPE__ int +// PPC-LINUX:#define __WCHAR_WIDTH__ 32 +// PPC-LINUX:#define __WINT_TYPE__ unsigned int +// PPC-LINUX:#define __WINT_UNSIGNED__ 1 +// PPC-LINUX:#define __WINT_WIDTH__ 32 +// PPC-LINUX:#define __powerpc__ 1 +// PPC-LINUX:#define __ppc__ 1 +// +// RUN: %clang_cc1 -E -dM -ffreestanding -triple=sparc-none-none < /dev/null | FileCheck -check-prefix SPARC %s +// +// SPARC:#define __CHAR16_TYPE__ unsigned short +// SPARC:#define __CHAR32_TYPE__ unsigned int +// SPARC:#define __CHAR_BIT__ 8 +// SPARC:#define __DBL_DENORM_MIN__ 4.9406564584124654e-324 +// SPARC:#define __DBL_DIG__ 15 +// SPARC:#define __DBL_EPSILON__ 2.2204460492503131e-16 +// SPARC:#define __DBL_HAS_DENORM__ 1 +// SPARC:#define __DBL_HAS_INFINITY__ 1 +// SPARC:#define __DBL_HAS_QUIET_NAN__ 1 +// SPARC:#define __DBL_MANT_DIG__ 53 +// SPARC:#define __DBL_MAX_10_EXP__ 308 +// SPARC:#define __DBL_MAX_EXP__ 1024 +// SPARC:#define __DBL_MAX__ 1.7976931348623157e+308 +// SPARC:#define __DBL_MIN_10_EXP__ (-307) +// SPARC:#define __DBL_MIN_EXP__ (-1021) +// SPARC:#define __DBL_MIN__ 2.2250738585072014e-308 +// SPARC:#define __DECIMAL_DIG__ 17 +// SPARC:#define __FLT_DENORM_MIN__ 1.40129846e-45F +// SPARC:#define __FLT_DIG__ 6 +// SPARC:#define __FLT_EPSILON__ 1.19209290e-7F +// SPARC:#define __FLT_EVAL_METHOD__ 0 +// SPARC:#define __FLT_HAS_DENORM__ 1 +// SPARC:#define __FLT_HAS_INFINITY__ 1 +// SPARC:#define __FLT_HAS_QUIET_NAN__ 1 +// SPARC:#define __FLT_MANT_DIG__ 24 +// SPARC:#define __FLT_MAX_10_EXP__ 38 +// SPARC:#define __FLT_MAX_EXP__ 128 +// SPARC:#define __FLT_MAX__ 3.40282347e+38F +// SPARC:#define __FLT_MIN_10_EXP__ (-37) +// SPARC:#define __FLT_MIN_EXP__ (-125) +// SPARC:#define __FLT_MIN__ 1.17549435e-38F +// SPARC:#define __FLT_RADIX__ 2 +// SPARC:#define __INT16_TYPE__ short +// SPARC:#define __INT32_TYPE__ int +// SPARC:#define __INT64_C_SUFFIX__ LL +// SPARC:#define __INT64_TYPE__ long long int +// SPARC:#define __INT8_TYPE__ char +// SPARC:#define __INTMAX_MAX__ 9223372036854775807LL +// SPARC:#define __INTMAX_TYPE__ long long int +// SPARC:#define __INTMAX_WIDTH__ 64 +// SPARC:#define __INTPTR_TYPE__ long int +// SPARC:#define __INTPTR_WIDTH__ 32 +// SPARC:#define __INT_MAX__ 2147483647 +// SPARC:#define __LDBL_DENORM_MIN__ 4.9406564584124654e-324 +// SPARC:#define __LDBL_DIG__ 15 +// SPARC:#define __LDBL_EPSILON__ 2.2204460492503131e-16 +// SPARC:#define __LDBL_HAS_DENORM__ 1 +// SPARC:#define __LDBL_HAS_INFINITY__ 1 +// SPARC:#define __LDBL_HAS_QUIET_NAN__ 1 +// SPARC:#define __LDBL_MANT_DIG__ 53 +// SPARC:#define __LDBL_MAX_10_EXP__ 308 +// SPARC:#define __LDBL_MAX_EXP__ 1024 +// SPARC:#define __LDBL_MAX__ 1.7976931348623157e+308 +// SPARC:#define __LDBL_MIN_10_EXP__ (-307) +// SPARC:#define __LDBL_MIN_EXP__ (-1021) +// SPARC:#define __LDBL_MIN__ 2.2250738585072014e-308 +// SPARC:#define __LONG_LONG_MAX__ 9223372036854775807LL +// SPARC:#define __LONG_MAX__ 2147483647L +// SPARC:#define __NO_INLINE__ 1 +// SPARC:#define __POINTER_WIDTH__ 32 +// SPARC:#define __PTRDIFF_TYPE__ long int +// SPARC:#define __PTRDIFF_WIDTH__ 32 +// SPARC:#define __REGISTER_PREFIX__ +// SPARC:#define __SCHAR_MAX__ 127 +// SPARC:#define __SHRT_MAX__ 32767 +// SPARC:#define __SIG_ATOMIC_WIDTH__ 32 +// SPARC:#define __SIZEOF_DOUBLE__ 8 +// SPARC:#define __SIZEOF_FLOAT__ 4 +// SPARC:#define __SIZEOF_INT__ 4 +// SPARC:#define __SIZEOF_LONG_DOUBLE__ 8 +// SPARC:#define __SIZEOF_LONG_LONG__ 8 +// SPARC:#define __SIZEOF_LONG__ 4 +// SPARC:#define __SIZEOF_POINTER__ 4 +// SPARC:#define __SIZEOF_PTRDIFF_T__ 4 +// SPARC:#define __SIZEOF_SHORT__ 2 +// SPARC:#define __SIZEOF_SIZE_T__ 4 +// SPARC:#define __SIZEOF_WCHAR_T__ 4 +// SPARC:#define __SIZEOF_WINT_T__ 4 +// SPARC:#define __SIZE_TYPE__ long unsigned int +// SPARC:#define __SIZE_WIDTH__ 32 +// SPARC:#define __UINTMAX_TYPE__ long long unsigned int +// SPARC:#define __USER_LABEL_PREFIX__ _ +// SPARC:#define __VERSION__ "4.2.1 Compatible +// SPARC:#define __WCHAR_MAX__ 2147483647 +// SPARC:#define __WCHAR_TYPE__ int +// SPARC:#define __WCHAR_WIDTH__ 32 +// SPARC:#define __WINT_TYPE__ int +// SPARC:#define __WINT_WIDTH__ 32 +// SPARC:#define __sparc 1 +// SPARC:#define __sparc__ 1 +// SPARC:#define __sparcv8 1 +// SPARC:#define sparc 1 +// +// RUN: %clang_cc1 -E -dM -ffreestanding -triple=tce-none-none < /dev/null | FileCheck -check-prefix TCE %s +// +// TCE:#define __CHAR16_TYPE__ unsigned short +// TCE:#define __CHAR32_TYPE__ unsigned int +// TCE:#define __CHAR_BIT__ 8 +// TCE:#define __DBL_DENORM_MIN__ 1.40129846e-45F +// TCE:#define __DBL_DIG__ 6 +// TCE:#define __DBL_EPSILON__ 1.19209290e-7F +// TCE:#define __DBL_HAS_DENORM__ 1 +// TCE:#define __DBL_HAS_INFINITY__ 1 +// TCE:#define __DBL_HAS_QUIET_NAN__ 1 +// TCE:#define __DBL_MANT_DIG__ 24 +// TCE:#define __DBL_MAX_10_EXP__ 38 +// TCE:#define __DBL_MAX_EXP__ 128 +// TCE:#define __DBL_MAX__ 3.40282347e+38F +// TCE:#define __DBL_MIN_10_EXP__ (-37) +// TCE:#define __DBL_MIN_EXP__ (-125) +// TCE:#define __DBL_MIN__ 1.17549435e-38F +// TCE:#define __DECIMAL_DIG__ -1 +// TCE:#define __FLT_DENORM_MIN__ 1.40129846e-45F +// TCE:#define __FLT_DIG__ 6 +// TCE:#define __FLT_EPSILON__ 1.19209290e-7F +// TCE:#define __FLT_EVAL_METHOD__ 0 +// TCE:#define __FLT_HAS_DENORM__ 1 +// TCE:#define __FLT_HAS_INFINITY__ 1 +// TCE:#define __FLT_HAS_QUIET_NAN__ 1 +// TCE:#define __FLT_MANT_DIG__ 24 +// TCE:#define __FLT_MAX_10_EXP__ 38 +// TCE:#define __FLT_MAX_EXP__ 128 +// TCE:#define __FLT_MAX__ 3.40282347e+38F +// TCE:#define __FLT_MIN_10_EXP__ (-37) +// TCE:#define __FLT_MIN_EXP__ (-125) +// TCE:#define __FLT_MIN__ 1.17549435e-38F +// TCE:#define __FLT_RADIX__ 2 +// TCE:#define __INT16_TYPE__ short +// TCE:#define __INT32_TYPE__ int +// TCE:#define __INT8_TYPE__ char +// TCE:#define __INTMAX_MAX__ 2147483647L +// TCE:#define __INTMAX_TYPE__ long int +// TCE:#define __INTMAX_WIDTH__ 32 +// TCE:#define __INTPTR_TYPE__ int +// TCE:#define __INTPTR_WIDTH__ 32 +// TCE:#define __INT_MAX__ 2147483647 +// TCE:#define __LDBL_DENORM_MIN__ 1.40129846e-45F +// TCE:#define __LDBL_DIG__ 6 +// TCE:#define __LDBL_EPSILON__ 1.19209290e-7F +// TCE:#define __LDBL_HAS_DENORM__ 1 +// TCE:#define __LDBL_HAS_INFINITY__ 1 +// TCE:#define __LDBL_HAS_QUIET_NAN__ 1 +// TCE:#define __LDBL_MANT_DIG__ 24 +// TCE:#define __LDBL_MAX_10_EXP__ 38 +// TCE:#define __LDBL_MAX_EXP__ 128 +// TCE:#define __LDBL_MAX__ 3.40282347e+38F +// TCE:#define __LDBL_MIN_10_EXP__ (-37) +// TCE:#define __LDBL_MIN_EXP__ (-125) +// TCE:#define __LDBL_MIN__ 1.17549435e-38F +// TCE:#define __LONG_LONG_MAX__ 2147483647LL +// TCE:#define __LONG_MAX__ 2147483647L +// TCE:#define __NO_INLINE__ 1 +// TCE:#define __POINTER_WIDTH__ 32 +// TCE:#define __PTRDIFF_TYPE__ int +// TCE:#define __PTRDIFF_WIDTH__ 32 +// TCE:#define __SCHAR_MAX__ 127 +// TCE:#define __SHRT_MAX__ 32767 +// TCE:#define __SIG_ATOMIC_WIDTH__ 32 +// TCE:#define __SIZEOF_DOUBLE__ 4 +// TCE:#define __SIZEOF_FLOAT__ 4 +// TCE:#define __SIZEOF_INT__ 4 +// TCE:#define __SIZEOF_LONG_DOUBLE__ 4 +// TCE:#define __SIZEOF_LONG_LONG__ 4 +// TCE:#define __SIZEOF_LONG__ 4 +// TCE:#define __SIZEOF_POINTER__ 4 +// TCE:#define __SIZEOF_PTRDIFF_T__ 4 +// TCE:#define __SIZEOF_SHORT__ 2 +// TCE:#define __SIZEOF_SIZE_T__ 4 +// TCE:#define __SIZEOF_WCHAR_T__ 4 +// TCE:#define __SIZEOF_WINT_T__ 4 +// TCE:#define __SIZE_TYPE__ unsigned int +// TCE:#define __SIZE_WIDTH__ 32 +// TCE:#define __TCE_V1__ 1 +// TCE:#define __TCE__ 1 +// TCE:#define __UINTMAX_TYPE__ long unsigned int +// TCE:#define __USER_LABEL_PREFIX__ _ +// TCE:#define __WCHAR_MAX__ 2147483647 +// TCE:#define __WCHAR_TYPE__ int +// TCE:#define __WCHAR_WIDTH__ 32 +// TCE:#define __WINT_TYPE__ int +// TCE:#define __WINT_WIDTH__ 32 +// TCE:#define __tce 1 +// TCE:#define __tce__ 1 +// TCE:#define tce 1 +// +// RUN: %clang_cc1 -E -dM -ffreestanding -triple=x86_64-none-none < /dev/null | FileCheck -check-prefix X86_64 %s +// +// X86_64:#define _LP64 1 +// X86_64:#define __CHAR16_TYPE__ unsigned short +// X86_64:#define __CHAR32_TYPE__ unsigned int +// X86_64:#define __CHAR_BIT__ 8 +// X86_64:#define __DBL_DENORM_MIN__ 4.9406564584124654e-324 +// X86_64:#define __DBL_DIG__ 15 +// X86_64:#define __DBL_EPSILON__ 2.2204460492503131e-16 +// X86_64:#define __DBL_HAS_DENORM__ 1 +// X86_64:#define __DBL_HAS_INFINITY__ 1 +// X86_64:#define __DBL_HAS_QUIET_NAN__ 1 +// X86_64:#define __DBL_MANT_DIG__ 53 +// X86_64:#define __DBL_MAX_10_EXP__ 308 +// X86_64:#define __DBL_MAX_EXP__ 1024 +// X86_64:#define __DBL_MAX__ 1.7976931348623157e+308 +// X86_64:#define __DBL_MIN_10_EXP__ (-307) +// X86_64:#define __DBL_MIN_EXP__ (-1021) +// X86_64:#define __DBL_MIN__ 2.2250738585072014e-308 +// X86_64:#define __DECIMAL_DIG__ 21 +// X86_64:#define __FLT_DENORM_MIN__ 1.40129846e-45F +// X86_64:#define __FLT_DIG__ 6 +// X86_64:#define __FLT_EPSILON__ 1.19209290e-7F +// X86_64:#define __FLT_EVAL_METHOD__ 0 +// X86_64:#define __FLT_HAS_DENORM__ 1 +// X86_64:#define __FLT_HAS_INFINITY__ 1 +// X86_64:#define __FLT_HAS_QUIET_NAN__ 1 +// X86_64:#define __FLT_MANT_DIG__ 24 +// X86_64:#define __FLT_MAX_10_EXP__ 38 +// X86_64:#define __FLT_MAX_EXP__ 128 +// X86_64:#define __FLT_MAX__ 3.40282347e+38F +// X86_64:#define __FLT_MIN_10_EXP__ (-37) +// X86_64:#define __FLT_MIN_EXP__ (-125) +// X86_64:#define __FLT_MIN__ 1.17549435e-38F +// X86_64:#define __FLT_RADIX__ 2 +// X86_64:#define __INT16_TYPE__ short +// X86_64:#define __INT32_TYPE__ int +// X86_64:#define __INT64_C_SUFFIX__ L +// X86_64:#define __INT64_TYPE__ long int +// X86_64:#define __INT8_TYPE__ char +// X86_64:#define __INTMAX_MAX__ 9223372036854775807L +// X86_64:#define __INTMAX_TYPE__ long int +// X86_64:#define __INTMAX_WIDTH__ 64 +// X86_64:#define __INTPTR_TYPE__ long int +// X86_64:#define __INTPTR_WIDTH__ 64 +// X86_64:#define __INT_MAX__ 2147483647 +// X86_64:#define __LDBL_DENORM_MIN__ 3.64519953188247460253e-4951L +// X86_64:#define __LDBL_DIG__ 18 +// X86_64:#define __LDBL_EPSILON__ 1.08420217248550443401e-19L +// X86_64:#define __LDBL_HAS_DENORM__ 1 +// X86_64:#define __LDBL_HAS_INFINITY__ 1 +// X86_64:#define __LDBL_HAS_QUIET_NAN__ 1 +// X86_64:#define __LDBL_MANT_DIG__ 64 +// X86_64:#define __LDBL_MAX_10_EXP__ 4932 +// X86_64:#define __LDBL_MAX_EXP__ 16384 +// X86_64:#define __LDBL_MAX__ 1.18973149535723176502e+4932L +// X86_64:#define __LDBL_MIN_10_EXP__ (-4931) +// X86_64:#define __LDBL_MIN_EXP__ (-16381) +// X86_64:#define __LDBL_MIN__ 3.36210314311209350626e-4932L +// X86_64:#define __LITTLE_ENDIAN__ 1 +// X86_64:#define __LONG_LONG_MAX__ 9223372036854775807LL +// X86_64:#define __LONG_MAX__ 9223372036854775807L +// X86_64:#define __LP64__ 1 +// X86_64:#define __MMX__ 1 +// X86_64:#define __NO_INLINE__ 1 +// X86_64:#define __NO_MATH_INLINES 1 +// X86_64:#define __POINTER_WIDTH__ 64 +// X86_64:#define __PTRDIFF_TYPE__ long int +// X86_64:#define __PTRDIFF_WIDTH__ 64 +// X86_64:#define __REGISTER_PREFIX__ +// X86_64:#define __SCHAR_MAX__ 127 +// X86_64:#define __SHRT_MAX__ 32767 +// X86_64:#define __SIG_ATOMIC_WIDTH__ 32 +// X86_64:#define __SIZEOF_DOUBLE__ 8 +// X86_64:#define __SIZEOF_FLOAT__ 4 +// X86_64:#define __SIZEOF_INT__ 4 +// X86_64:#define __SIZEOF_LONG_DOUBLE__ 16 +// X86_64:#define __SIZEOF_LONG_LONG__ 8 +// X86_64:#define __SIZEOF_LONG__ 8 +// X86_64:#define __SIZEOF_POINTER__ 8 +// X86_64:#define __SIZEOF_PTRDIFF_T__ 8 +// X86_64:#define __SIZEOF_SHORT__ 2 +// X86_64:#define __SIZEOF_SIZE_T__ 8 +// X86_64:#define __SIZEOF_WCHAR_T__ 4 +// X86_64:#define __SIZEOF_WINT_T__ 4 +// X86_64:#define __SIZE_TYPE__ long unsigned int +// X86_64:#define __SIZE_WIDTH__ 64 +// X86_64:#define __SSE2_MATH__ 1 +// X86_64:#define __SSE2__ 1 +// X86_64:#define __SSE_MATH__ 1 +// X86_64:#define __SSE__ 1 +// X86_64:#define __UINTMAX_TYPE__ long unsigned int +// X86_64:#define __USER_LABEL_PREFIX__ _ +// X86_64:#define __WCHAR_MAX__ 2147483647 +// X86_64:#define __WCHAR_TYPE__ int +// X86_64:#define __WCHAR_WIDTH__ 32 +// X86_64:#define __WINT_TYPE__ int +// X86_64:#define __WINT_WIDTH__ 32 +// X86_64:#define __amd64 1 +// X86_64:#define __amd64__ 1 +// X86_64:#define __x86_64 1 +// X86_64:#define __x86_64__ 1 +// +// RUN: %clang_cc1 -E -dM -ffreestanding -triple=x86_64-pc-linux-gnu < /dev/null | FileCheck -check-prefix X86_64-LINUX %s +// +// X86_64-LINUX:#define _LP64 1 +// X86_64-LINUX:#define __CHAR16_TYPE__ unsigned short +// X86_64-LINUX:#define __CHAR32_TYPE__ unsigned int +// X86_64-LINUX:#define __CHAR_BIT__ 8 +// X86_64-LINUX:#define __DBL_DENORM_MIN__ 4.9406564584124654e-324 +// X86_64-LINUX:#define __DBL_DIG__ 15 +// X86_64-LINUX:#define __DBL_EPSILON__ 2.2204460492503131e-16 +// X86_64-LINUX:#define __DBL_HAS_DENORM__ 1 +// X86_64-LINUX:#define __DBL_HAS_INFINITY__ 1 +// X86_64-LINUX:#define __DBL_HAS_QUIET_NAN__ 1 +// X86_64-LINUX:#define __DBL_MANT_DIG__ 53 +// X86_64-LINUX:#define __DBL_MAX_10_EXP__ 308 +// X86_64-LINUX:#define __DBL_MAX_EXP__ 1024 +// X86_64-LINUX:#define __DBL_MAX__ 1.7976931348623157e+308 +// X86_64-LINUX:#define __DBL_MIN_10_EXP__ (-307) +// X86_64-LINUX:#define __DBL_MIN_EXP__ (-1021) +// X86_64-LINUX:#define __DBL_MIN__ 2.2250738585072014e-308 +// X86_64-LINUX:#define __DECIMAL_DIG__ 21 +// X86_64-LINUX:#define __FLT_DENORM_MIN__ 1.40129846e-45F +// X86_64-LINUX:#define __FLT_DIG__ 6 +// X86_64-LINUX:#define __FLT_EPSILON__ 1.19209290e-7F +// X86_64-LINUX:#define __FLT_EVAL_METHOD__ 0 +// X86_64-LINUX:#define __FLT_HAS_DENORM__ 1 +// X86_64-LINUX:#define __FLT_HAS_INFINITY__ 1 +// X86_64-LINUX:#define __FLT_HAS_QUIET_NAN__ 1 +// X86_64-LINUX:#define __FLT_MANT_DIG__ 24 +// X86_64-LINUX:#define __FLT_MAX_10_EXP__ 38 +// X86_64-LINUX:#define __FLT_MAX_EXP__ 128 +// X86_64-LINUX:#define __FLT_MAX__ 3.40282347e+38F +// X86_64-LINUX:#define __FLT_MIN_10_EXP__ (-37) +// X86_64-LINUX:#define __FLT_MIN_EXP__ (-125) +// X86_64-LINUX:#define __FLT_MIN__ 1.17549435e-38F +// X86_64-LINUX:#define __FLT_RADIX__ 2 +// X86_64-LINUX:#define __INT16_TYPE__ short +// X86_64-LINUX:#define __INT32_TYPE__ int +// X86_64-LINUX:#define __INT64_C_SUFFIX__ L +// X86_64-LINUX:#define __INT64_TYPE__ long int +// X86_64-LINUX:#define __INT8_TYPE__ char +// X86_64-LINUX:#define __INTMAX_MAX__ 9223372036854775807L +// X86_64-LINUX:#define __INTMAX_TYPE__ long int +// X86_64-LINUX:#define __INTMAX_WIDTH__ 64 +// X86_64-LINUX:#define __INTPTR_TYPE__ long int +// X86_64-LINUX:#define __INTPTR_WIDTH__ 64 +// X86_64-LINUX:#define __INT_MAX__ 2147483647 +// X86_64-LINUX:#define __LDBL_DENORM_MIN__ 3.64519953188247460253e-4951L +// X86_64-LINUX:#define __LDBL_DIG__ 18 +// X86_64-LINUX:#define __LDBL_EPSILON__ 1.08420217248550443401e-19L +// X86_64-LINUX:#define __LDBL_HAS_DENORM__ 1 +// X86_64-LINUX:#define __LDBL_HAS_INFINITY__ 1 +// X86_64-LINUX:#define __LDBL_HAS_QUIET_NAN__ 1 +// X86_64-LINUX:#define __LDBL_MANT_DIG__ 64 +// X86_64-LINUX:#define __LDBL_MAX_10_EXP__ 4932 +// X86_64-LINUX:#define __LDBL_MAX_EXP__ 16384 +// X86_64-LINUX:#define __LDBL_MAX__ 1.18973149535723176502e+4932L +// X86_64-LINUX:#define __LDBL_MIN_10_EXP__ (-4931) +// X86_64-LINUX:#define __LDBL_MIN_EXP__ (-16381) +// X86_64-LINUX:#define __LDBL_MIN__ 3.36210314311209350626e-4932L +// X86_64-LINUX:#define __LITTLE_ENDIAN__ 1 +// X86_64-LINUX:#define __LONG_LONG_MAX__ 9223372036854775807LL +// X86_64-LINUX:#define __LONG_MAX__ 9223372036854775807L +// X86_64-LINUX:#define __LP64__ 1 +// X86_64-LINUX:#define __MMX__ 1 +// X86_64-LINUX:#define __NO_INLINE__ 1 +// X86_64-LINUX:#define __NO_MATH_INLINES 1 +// X86_64-LINUX:#define __POINTER_WIDTH__ 64 +// X86_64-LINUX:#define __PTRDIFF_TYPE__ long int +// X86_64-LINUX:#define __PTRDIFF_WIDTH__ 64 +// X86_64-LINUX:#define __REGISTER_PREFIX__ +// X86_64-LINUX:#define __SCHAR_MAX__ 127 +// X86_64-LINUX:#define __SHRT_MAX__ 32767 +// X86_64-LINUX:#define __SIG_ATOMIC_WIDTH__ 32 +// X86_64-LINUX:#define __SIZEOF_DOUBLE__ 8 +// X86_64-LINUX:#define __SIZEOF_FLOAT__ 4 +// X86_64-LINUX:#define __SIZEOF_INT__ 4 +// X86_64-LINUX:#define __SIZEOF_LONG_DOUBLE__ 16 +// X86_64-LINUX:#define __SIZEOF_LONG_LONG__ 8 +// X86_64-LINUX:#define __SIZEOF_LONG__ 8 +// X86_64-LINUX:#define __SIZEOF_POINTER__ 8 +// X86_64-LINUX:#define __SIZEOF_PTRDIFF_T__ 8 +// X86_64-LINUX:#define __SIZEOF_SHORT__ 2 +// X86_64-LINUX:#define __SIZEOF_SIZE_T__ 8 +// X86_64-LINUX:#define __SIZEOF_WCHAR_T__ 4 +// X86_64-LINUX:#define __SIZEOF_WINT_T__ 4 +// X86_64-LINUX:#define __SIZE_TYPE__ long unsigned int +// X86_64-LINUX:#define __SIZE_WIDTH__ 64 +// X86_64-LINUX:#define __SSE2_MATH__ 1 +// X86_64-LINUX:#define __SSE2__ 1 +// X86_64-LINUX:#define __SSE_MATH__ 1 +// X86_64-LINUX:#define __SSE__ 1 +// X86_64-LINUX:#define __UINTMAX_TYPE__ long unsigned int +// X86_64-LINUX:#define __USER_LABEL_PREFIX__ +// X86_64-LINUX:#define __WCHAR_MAX__ 2147483647 +// X86_64-LINUX:#define __WCHAR_TYPE__ int +// X86_64-LINUX:#define __WCHAR_WIDTH__ 32 +// X86_64-LINUX:#define __WINT_TYPE__ unsigned int +// X86_64-LINUX:#define __WINT_WIDTH__ 32 +// X86_64-LINUX:#define __amd64 1 +// X86_64-LINUX:#define __amd64__ 1 +// X86_64-LINUX:#define __x86_64 1 +// X86_64-LINUX:#define __x86_64__ 1 +// +// RUN: %clang_cc1 -x c++ -triple i686-pc-linux-gnu -fobjc-fragile-abi -E -dM < /dev/null | FileCheck -check-prefix GNUSOURCE %s +// GNUSOURCE:#define _GNU_SOURCE 1 +// +// RUN: %clang_cc1 -x c++ -std=c++98 -fno-rtti -E -dM < /dev/null | FileCheck -check-prefix NORTTI %s +// NORTTI: __GXX_ABI_VERSION +// NORTTI-NOT:#define __GXX_RTTI +// NORTTI: __STDC__ diff --git a/clang/test/Preprocessor/line-directive-output.c b/clang/test/Preprocessor/line-directive-output.c new file mode 100644 index 0000000..290703a --- /dev/null +++ b/clang/test/Preprocessor/line-directive-output.c @@ -0,0 +1,71 @@ +// RUN: %clang_cc1 -E %s 2>&1 | FileCheck %s -strict-whitespace +// PR6101 +int a; +// CHECK: # 1 "{{.*}}line-directive-output.c" +// CHECK: int a; + +// CHECK-NEXT: # 50 "{{.*}}line-directive-output.c" +// CHECK-NEXT: int b; +#line 50 +int b; + +// CHECK: # 13 "{{.*}}line-directive-output.c" +// CHECK-NEXT: int c; +# 13 +int c; + + +// CHECK-NEXT: # 1 "A.c" +#line 1 "A.c" +// CHECK-NEXT: # 2 "A.c" +#line 2 + +// CHECK-NEXT: # 1 "B.c" +#line 1 "B.c" + +// CHECK-NEXT: # 1000 "A.c" +#line 1000 "A.c" + +int y; + + + + + + + +// CHECK: # 1010 "A.c" +int z; + +extern int x; + +# 3 "temp2.h" 1 +extern int y; + +# 7 "A.c" 2 +extern int z; + + + + + + + + + + + + + +// CHECK: # 25 "A.c" + + +// CHECK: # 50 "C.c" 1 +# 50 "C.c" 1 + + +// CHECK-NEXT: # 2000 "A.c" 2 +# 2000 "A.c" 2 +# 42 "A.c" +# 44 "A.c" +# 49 "A.c" diff --git a/clang/test/Preprocessor/line-directive.c b/clang/test/Preprocessor/line-directive.c new file mode 100644 index 0000000..28e9302 --- /dev/null +++ b/clang/test/Preprocessor/line-directive.c @@ -0,0 +1,92 @@ +// RUN: %clang_cc1 -fsyntax-only -verify -pedantic %s +// RUN: %clang_cc1 -E %s 2>&1 | grep 'blonk.c:92:2: error: ABC' +// RUN: %clang_cc1 -E %s 2>&1 | grep 'blonk.c:93:2: error: DEF' + +#line 'a' // expected-error {{#line directive requires a positive integer argument}} +#line 0 // expected-error {{#line directive requires a positive integer argument}} +#line 00 // expected-error {{#line directive requires a positive integer argument}} +#line 2147483648 // expected-warning {{C requires #line number to be less than 2147483648, allowed as extension}} +#line 42 // ok +#line 42 'a' // expected-error {{invalid filename for #line directive}} +#line 42 "foo/bar/baz.h" // ok + + +// #line directives expand macros. +#define A 42 "foo" +#line A + +# 42 +# 42 "foo" +# 42 "foo" 2 // expected-error {{invalid line marker flag '2': cannot pop empty include stack}} +# 42 "foo" 1 3 // enter +# 42 "foo" 2 3 // exit +# 42 "foo" 2 3 4 // expected-error {{invalid line marker flag '2': cannot pop empty include stack}} +# 42 "foo" 3 4 + +# 'a' // expected-error {{invalid preprocessing directive}} +# 42 'f' // expected-error {{invalid filename for line marker directive}} +# 42 1 3 // expected-error {{invalid filename for line marker directive}} +# 42 "foo" 3 1 // expected-error {{invalid flag line marker directive}} +# 42 "foo" 42 // expected-error {{invalid flag line marker directive}} +# 42 "foo" 1 2 // expected-error {{invalid flag line marker directive}} + + +// These are checked by the RUN line. +#line 92 "blonk.c" +#error ABC // expected-error {{#error ABC}} +#error DEF // expected-error {{#error DEF}} + + +// Verify that linemarker diddling of the system header flag works. + +# 192 "glomp.h" // not a system header. +typedef int x; // expected-note {{previous definition is here}} +typedef int x; // expected-warning {{redefinition of typedef 'x' is a C11 feature}} + +# 192 "glomp.h" 3 // System header. +typedef int y; // ok +typedef int y; // ok + +typedef int q; // q is in system header. + +#line 42 "blonk.h" // doesn't change system headerness. + +typedef int z; // ok +typedef int z; // ok + +# 97 // doesn't change system headerness. + +typedef int z1; // ok +typedef int z1; // ok + +# 42 "blonk.h" // DOES change system headerness. + +typedef int w; // expected-note {{previous definition is here}} +typedef int w; // expected-warning {{redefinition of typedef 'w' is a C11 feature}} + +typedef int q; // original definition in system header, should not diagnose. + +// This should not produce an "extra tokens at end of #line directive" warning, +// because #line is allowed to contain expanded tokens. +#define EMPTY() +#line 2 "foo.c" EMPTY( ) +#line 2 "foo.c" NONEMPTY( ) // expected-warning{{extra tokens at end of #line directive}} + +// PR3940 +#line 0xf // expected-error {{#line directive requires a simple digit sequence}} +#line 42U // expected-error {{#line directive requires a simple digit sequence}} + + +// Line markers are digit strings interpreted as decimal numbers, this is +// 10, not 8. +#line 010 // expected-warning {{#line directive interprets number as decimal, not octal}} +extern int array[__LINE__ == 10 ? 1:-1]; + +/* PR3917 */ +#line 41 +extern char array2[\ +_\ +_LINE__ == 42 ? 1: -1]; /* line marker is location of first _ */ + + + diff --git a/clang/test/Preprocessor/macro-multiline.c b/clang/test/Preprocessor/macro-multiline.c new file mode 100644 index 0000000..df7c40a --- /dev/null +++ b/clang/test/Preprocessor/macro-multiline.c @@ -0,0 +1,8 @@ +// RUN: %clang -E %s "-DX=A +// RUN: THIS_SHOULD_NOT_EXIST_IN_THE_OUTPUT" > %t +// RUN: grep "GOOD: A" %t +// RUN: not grep THIS_SHOULD_NOT_EXIST_IN_THE_OUTPUT %t +// rdar://6762183 + +GOOD: X + diff --git a/clang/test/Preprocessor/macro_arg_directive.c b/clang/test/Preprocessor/macro_arg_directive.c new file mode 100644 index 0000000..5c9943d --- /dev/null +++ b/clang/test/Preprocessor/macro_arg_directive.c @@ -0,0 +1,20 @@ +// RUN: %clang_cc1 %s -fsyntax-only -verify + +// header1.h +void fail(const char *); +#define MUNCH(...) \ + ({ int result = 0; __VA_ARGS__; if (!result) { fail(#__VA_ARGS__); }; result }) + +static inline int f(int k) { + return MUNCH( // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{returning 'void'}} + if (k < 3) + result = 24; + else if (k > 4) + result = k - 4; +} + +#include "macro_arg_directive.h" // expected-error {{embedding a #include directive within macro arguments is not supported}} + +int g(int k) { + return f(k) + f(k-1)); +} diff --git a/clang/test/Preprocessor/macro_arg_directive.h b/clang/test/Preprocessor/macro_arg_directive.h new file mode 100644 index 0000000..892dbf2 --- /dev/null +++ b/clang/test/Preprocessor/macro_arg_directive.h @@ -0,0 +1,9 @@ +// Support header for macro_arg_directive.c + +int n; + +struct S { + int k; +}; + +void g(int); diff --git a/clang/test/Preprocessor/macro_arg_keyword.c b/clang/test/Preprocessor/macro_arg_keyword.c new file mode 100644 index 0000000..b9bbbf3 --- /dev/null +++ b/clang/test/Preprocessor/macro_arg_keyword.c @@ -0,0 +1,6 @@ +// RUN: %clang_cc1 -E %s | grep xxx-xxx + +#define foo(return) return-return + +foo(xxx) + diff --git a/clang/test/Preprocessor/macro_disable.c b/clang/test/Preprocessor/macro_disable.c new file mode 100644 index 0000000..d7859dc --- /dev/null +++ b/clang/test/Preprocessor/macro_disable.c @@ -0,0 +1,43 @@ +// RUN: %clang_cc1 %s -E | FileCheck -strict-whitespace %s +// Check for C99 6.10.3.4p2. + +#define f(a) f(x * (a)) +#define x 2 +#define z z[0] +f(f(z)); +// CHECK: f(2 * (f(2 * (z[0])))); + + + +#define A A B C +#define B B C A +#define C C A B +A +// CHECK: A B C A B A C A B C A + + +// PR1820 +#define i(x) h(x +#define h(x) x(void) +extern int i(i)); +// CHECK: int i(void) + + +#define M_0(x) M_ ## x +#define M_1(x) x + M_0(0) +#define M_2(x) x + M_1(1) +#define M_3(x) x + M_2(2) +#define M_4(x) x + M_3(3) +#define M_5(x) x + M_4(4) + +a: M_0(1)(2)(3)(4)(5); +b: M_0(5)(4)(3)(2)(1); + +// CHECK: a: 2 + M_0(3)(4)(5); +// CHECK: b: 4 + 4 + 3 + 2 + 1 + M_0(3)(2)(1); + +#define n(v) v +#define l m +#define m l a +c: n(m) X +// CHECK: c: m a X diff --git a/clang/test/Preprocessor/macro_expand.c b/clang/test/Preprocessor/macro_expand.c new file mode 100644 index 0000000..4dc0357 --- /dev/null +++ b/clang/test/Preprocessor/macro_expand.c @@ -0,0 +1,19 @@ +// RUN: %clang_cc1 -E %s | grep '^A: Y$' +// RUN: %clang_cc1 -E %s | grep '^B: f()$' +// RUN: %clang_cc1 -E %s | grep '^C: for()$' + +#define X() Y +#define Y() X + +A: X()()() + +// PR3927 +#define f(x) h(x +#define for(x) h(x +#define h(x) x() +B: f(f)) +C: for(for)) + +// rdar://6880648 +#define f(x,y...) y +f() diff --git a/clang/test/Preprocessor/macro_expandloc.c b/clang/test/Preprocessor/macro_expandloc.c new file mode 100644 index 0000000..f466013 --- /dev/null +++ b/clang/test/Preprocessor/macro_expandloc.c @@ -0,0 +1,6 @@ +// RUN: %clang_cc1 %s -E 2>&1 | grep '#include' +#define FOO 1 + +// The error message should be on the #include line, not the 1. +#include FOO + diff --git a/clang/test/Preprocessor/macro_expandloc2.c b/clang/test/Preprocessor/macro_expandloc2.c new file mode 100644 index 0000000..4aa7dfe --- /dev/null +++ b/clang/test/Preprocessor/macro_expandloc2.c @@ -0,0 +1,6 @@ +// RUN: %clang_cc1 %s -E 2>&1 | grep '#include' +#define FOO BAR + +// The error message should be on the #include line, not the 1. +#include FOO + diff --git a/clang/test/Preprocessor/macro_fn.c b/clang/test/Preprocessor/macro_fn.c new file mode 100644 index 0000000..85733b4 --- /dev/null +++ b/clang/test/Preprocessor/macro_fn.c @@ -0,0 +1,46 @@ +/* RUN: %clang_cc1 %s -Eonly -std=c89 -pedantic -verify +*/ +/* PR3937 */ +#define zero() 0 +#define one(x) 0 +#define two(x, y) 0 +#define zero_dot(...) 0 /* expected-warning {{variadic macros were introduced in C99}} */ +#define one_dot(x, ...) 0 /* expected-warning {{variadic macros were introduced in C99}} */ + +zero() +zero(1); /* expected-error {{too many arguments provided to function-like macro invocation}} */ +zero(1, 2, 3); /* expected-error {{too many arguments provided to function-like macro invocation}} */ + +one() /* ok */ +one(a) +one(a,) /* expected-error {{too many arguments provided to function-like macro invocation}} */ +one(a, b) /* expected-error {{too many arguments provided to function-like macro invocation}} */ + +two() /* expected-error {{too few arguments provided to function-like macro invocation}} */ +two(a) /* expected-error {{too few arguments provided to function-like macro invocation}} */ +two(a,b) +two(a, ) /* expected-warning {{empty macro arguments were standardized in C99}} */ +two(a,b,c) /* expected-error {{too many arguments provided to function-like macro invocation}} */ +two( + , /* expected-warning {{empty macro arguments were standardized in C99}} */ + , /* expected-warning {{empty macro arguments were standardized in C99}} \ + expected-error {{too many arguments provided to function-like macro invocation}} */ + ) +two(,) /* expected-warning 2 {{empty macro arguments were standardized in C99}} */ + + + +/* PR4006 & rdar://6807000 */ +#define e(...) __VA_ARGS__ /* expected-warning {{variadic macros were introduced in C99}} */ +e(x) +e() + +zero_dot() +one_dot(x) /* empty ... argument: expected-warning {{varargs argument missing, but tolerated as an extension}} */ +one_dot() /* empty first argument, elided ...: expected-warning {{varargs argument missing, but tolerated as an extension}} */ + + +/* rdar://6816766 - Crash with function-like macro test at end of directive. */ +#define E() (i == 0) +#if E +#endif diff --git a/clang/test/Preprocessor/macro_fn_comma_swallow.c b/clang/test/Preprocessor/macro_fn_comma_swallow.c new file mode 100644 index 0000000..726a889 --- /dev/null +++ b/clang/test/Preprocessor/macro_fn_comma_swallow.c @@ -0,0 +1,28 @@ +// Test the GNU comma swallowing extension. +// RUN: %clang_cc1 %s -E | FileCheck -strict-whitespace %s + +// CHECK: 1: foo{A, } +#define X(Y) foo{A, Y} +1: X() + + +// CHECK: 2: fo2{A,} +#define X2(Y) fo2{A,##Y} +2: X2() + +// should eat the comma. +// CHECK: 3: {foo} +#define X3(b, ...) {b, ## __VA_ARGS__} +3: X3(foo) + + + +// PR3880 +// CHECK: 4: AA BB +#define X4(...) AA , ## __VA_ARGS__ BB +4: X4() + +// PR7943 +// CHECK: 5: 1 +#define X5(x,...) x##,##__VA_ARGS__ +5: X5(1) diff --git a/clang/test/Preprocessor/macro_fn_disable_expand.c b/clang/test/Preprocessor/macro_fn_disable_expand.c new file mode 100644 index 0000000..16948dc --- /dev/null +++ b/clang/test/Preprocessor/macro_fn_disable_expand.c @@ -0,0 +1,30 @@ +// RUN: %clang_cc1 %s -E | FileCheck %s + +#define foo(x) bar x +foo(foo) (2) +// CHECK: bar foo (2) + +#define m(a) a(w) +#define w ABCD +m(m) +// CHECK: m(ABCD) + + + +// rdar://7466570 PR4438, PR5163 + +// We should get '42' in the argument list for gcc compatibility. +#define A 1 +#define B 2 +#define C(x) (x + 1) + +X: C( +#ifdef A +#if A == 1 +#if B + 42 +#endif +#endif +#endif + ) +// CHECK: X: (42 + 1) diff --git a/clang/test/Preprocessor/macro_fn_lparen_scan.c b/clang/test/Preprocessor/macro_fn_lparen_scan.c new file mode 100644 index 0000000..0218469 --- /dev/null +++ b/clang/test/Preprocessor/macro_fn_lparen_scan.c @@ -0,0 +1,27 @@ +// RUN: %clang_cc1 -E %s | grep 'noexp: foo y' +// RUN: %clang_cc1 -E %s | grep 'expand: abc' +// RUN: %clang_cc1 -E %s | grep 'noexp2: foo nonexp' +// RUN: %clang_cc1 -E %s | grep 'expand2: abc' + +#define A foo +#define foo() abc +#define X A y + +// This should not expand to abc, because the foo macro isn't followed by (. +noexp: X + + +// This should expand to abc. +#undef X +#define X A () +expand: X + + +// This should be 'foo nonexp' +noexp2: A nonexp + +// This should expand +expand2: A ( +) + + diff --git a/clang/test/Preprocessor/macro_fn_lparen_scan2.c b/clang/test/Preprocessor/macro_fn_lparen_scan2.c new file mode 100644 index 0000000..c23e741 --- /dev/null +++ b/clang/test/Preprocessor/macro_fn_lparen_scan2.c @@ -0,0 +1,7 @@ +// RUN: %clang_cc1 -E %s | grep 'FUNC (3 +1);' + +#define F(a) a +#define FUNC(a) (a+1) + +F(FUNC) FUNC (3); /* final token sequence is FUNC(3+1) */ + diff --git a/clang/test/Preprocessor/macro_fn_placemarker.c b/clang/test/Preprocessor/macro_fn_placemarker.c new file mode 100644 index 0000000..1791054 --- /dev/null +++ b/clang/test/Preprocessor/macro_fn_placemarker.c @@ -0,0 +1,5 @@ +// RUN: %clang_cc1 %s -E | grep 'foo(A, )' + +#define X(Y) foo(A, Y) +X() + diff --git a/clang/test/Preprocessor/macro_fn_preexpand.c b/clang/test/Preprocessor/macro_fn_preexpand.c new file mode 100644 index 0000000..1b94c82 --- /dev/null +++ b/clang/test/Preprocessor/macro_fn_preexpand.c @@ -0,0 +1,12 @@ +// RUN: %clang_cc1 %s -E | grep 'pre: 1 1 X' +// RUN: %clang_cc1 %s -E | grep 'nopre: 1A(X)' + +/* Preexpansion of argument. */ +#define A(X) 1 X +pre: A(A(X)) + +/* The ## operator disables preexpansion. */ +#undef A +#define A(X) 1 ## X +nopre: A(A(X)) + diff --git a/clang/test/Preprocessor/macro_fn_varargs_iso.c b/clang/test/Preprocessor/macro_fn_varargs_iso.c new file mode 100644 index 0000000..a1aab26 --- /dev/null +++ b/clang/test/Preprocessor/macro_fn_varargs_iso.c @@ -0,0 +1,11 @@ + +// RUN: %clang_cc1 -E %s | grep 'foo{a, b, c, d, e}' +// RUN: %clang_cc1 -E %s | grep 'foo2{d, C, B}' +// RUN: %clang_cc1 -E %s | grep 'foo2{d,e, C, B}' + +#define va1(...) foo{a, __VA_ARGS__, e} +va1(b, c, d) +#define va2(a, b, ...) foo2{__VA_ARGS__, b, a} +va2(B, C, d) +va2(B, C, d,e) + diff --git a/clang/test/Preprocessor/macro_fn_varargs_named.c b/clang/test/Preprocessor/macro_fn_varargs_named.c new file mode 100644 index 0000000..b50d53d --- /dev/null +++ b/clang/test/Preprocessor/macro_fn_varargs_named.c @@ -0,0 +1,10 @@ +// RUN: %clang_cc1 -E %s | grep '^a: x$' +// RUN: %clang_cc1 -E %s | grep '^b: x y, z,h$' +// RUN: %clang_cc1 -E %s | grep '^c: foo(x)$' + +#define A(b, c...) b c +a: A(x) +b: A(x, y, z,h) + +#define B(b, c...) foo(b, ## c) +c: B(x) diff --git a/clang/test/Preprocessor/macro_misc.c b/clang/test/Preprocessor/macro_misc.c new file mode 100644 index 0000000..53d9982 --- /dev/null +++ b/clang/test/Preprocessor/macro_misc.c @@ -0,0 +1,23 @@ +// RUN: %clang_cc1 %s -Eonly -verify + +// This should not be rejected. +#ifdef defined +#endif + + + +// PR3764 + +// This should not produce a redefinition warning. +#define FUNC_LIKE(a) (a) +#define FUNC_LIKE(a)(a) + +// This either. +#define FUNC_LIKE2(a)\ +(a) +#define FUNC_LIKE2(a) (a) + +// This should. +#define FUNC_LIKE3(a) ( a) // expected-note {{previous definition is here}} +#define FUNC_LIKE3(a) (a) // expected-warning {{'FUNC_LIKE3' macro redefined}} + diff --git a/clang/test/Preprocessor/macro_not_define.c b/clang/test/Preprocessor/macro_not_define.c new file mode 100644 index 0000000..82648d4 --- /dev/null +++ b/clang/test/Preprocessor/macro_not_define.c @@ -0,0 +1,9 @@ +// RUN: %clang_cc1 -E %s | grep '^ # define X 3$' + +#define H # + #define D define + + #define DEFINE(a, b) H D a b + + DEFINE(X, 3) + diff --git a/clang/test/Preprocessor/macro_paste_bad.c b/clang/test/Preprocessor/macro_paste_bad.c new file mode 100644 index 0000000..0a028a4 --- /dev/null +++ b/clang/test/Preprocessor/macro_paste_bad.c @@ -0,0 +1,34 @@ +// RUN: %clang_cc1 -Eonly -verify -pedantic %s +// pasting ""x"" and ""+"" does not give a valid preprocessing token +#define XYZ x ## + +XYZ // expected-error {{pasting formed 'x+', an invalid preprocessing token}} +#define XXYZ . ## test +XXYZ // expected-error {{pasting formed '.test', an invalid preprocessing token}} + +// GCC PR 20077 + +#define a a ## ## // expected-error {{'##' cannot appear at end of macro expansion}} +#define b() b ## ## // expected-error {{'##' cannot appear at end of macro expansion}} +#define c c ## // expected-error {{'##' cannot appear at end of macro expansion}} +#define d() d ## // expected-error {{'##' cannot appear at end of macro expansion}} + + +#define e ## ## e // expected-error {{'##' cannot appear at start of macro expansion}} +#define f() ## ## f // expected-error {{'##' cannot appear at start of macro expansion}} +#define g ## g // expected-error {{'##' cannot appear at start of macro expansion}} +#define h() ## h // expected-error {{'##' cannot appear at start of macro expansion}} +#define i ## // expected-error {{'##' cannot appear at start of macro expansion}} +#define j() ## // expected-error {{'##' cannot appear at start of macro expansion}} + +// Invalid token pasting. +// PR3918 + +// When pasting creates poisoned identifiers, we error. +#pragma GCC poison BLARG +BLARG // expected-error {{attempt to use a poisoned identifier}} +#define XX BL ## ARG +XX // expected-error {{attempt to use a poisoned identifier}} + +#define VA __VA_ ## ARGS__ +int VA; // expected-warning {{__VA_ARGS__ can only appear in the expansion of a C99 variadic macro}} + diff --git a/clang/test/Preprocessor/macro_paste_bcpl_comment.c b/clang/test/Preprocessor/macro_paste_bcpl_comment.c new file mode 100644 index 0000000..fd07b1f --- /dev/null +++ b/clang/test/Preprocessor/macro_paste_bcpl_comment.c @@ -0,0 +1,5 @@ +// RUN: %clang_cc1 %s -Eonly 2>&1 | grep error + +#define COMM1 / ## / +COMM1 + diff --git a/clang/test/Preprocessor/macro_paste_c_block_comment.c b/clang/test/Preprocessor/macro_paste_c_block_comment.c new file mode 100644 index 0000000..c690a4c --- /dev/null +++ b/clang/test/Preprocessor/macro_paste_c_block_comment.c @@ -0,0 +1,5 @@ +// RUN: %clang_cc1 %s -Eonly -verify + +#define COMM / ## * +COMM // expected-error {{pasting formed '/*', an invalid preprocessing token}} + diff --git a/clang/test/Preprocessor/macro_paste_commaext.c b/clang/test/Preprocessor/macro_paste_commaext.c new file mode 100644 index 0000000..7cfe43d --- /dev/null +++ b/clang/test/Preprocessor/macro_paste_commaext.c @@ -0,0 +1,13 @@ +// RUN: %clang_cc1 %s -E | grep 'V);' +// RUN: %clang_cc1 %s -E | grep 'W, 1, 2);' +// RUN: %clang_cc1 %s -E | grep 'X, 1, 2);' +// RUN: %clang_cc1 %s -E | grep 'Y, );' +// RUN: %clang_cc1 %s -E | grep 'Z, );' + +#define debug(format, ...) format, ## __VA_ARGS__) +debug(V); +debug(W, 1, 2); +debug(X, 1, 2 ); +debug(Y, ); +debug(Z,); + diff --git a/clang/test/Preprocessor/macro_paste_empty.c b/clang/test/Preprocessor/macro_paste_empty.c new file mode 100644 index 0000000..2e26f14 --- /dev/null +++ b/clang/test/Preprocessor/macro_paste_empty.c @@ -0,0 +1,13 @@ +// RUN: %clang_cc1 -E %s | grep 'a:Y' +// RUN: %clang_cc1 -E %s | grep 'b:Y' +// RUN: %clang_cc1 -E %s | grep 'c:YY' + +#define FOO(X) X ## Y +a:FOO() + +#define FOO2(X) Y ## X +b:FOO2() + +#define FOO3(X) X ## Y ## X ## Y ## X ## X +c:FOO3() + diff --git a/clang/test/Preprocessor/macro_paste_hard.c b/clang/test/Preprocessor/macro_paste_hard.c new file mode 100644 index 0000000..fad8426 --- /dev/null +++ b/clang/test/Preprocessor/macro_paste_hard.c @@ -0,0 +1,17 @@ +// RUN: %clang_cc1 -E %s | grep '1: aaab 2' +// RUN: %clang_cc1 -E %s | grep '2: 2 baaa' +// RUN: %clang_cc1 -E %s | grep '3: 2 xx' + +#define a(n) aaa ## n +#define b 2 +1: a(b b) // aaab 2 2 gets expanded, not b. + +#undef a +#undef b +#define a(n) n ## aaa +#define b 2 +2: a(b b) // 2 baaa 2 gets expanded, not b. + +#define baaa xx +3: a(b b) // 2 xx + diff --git a/clang/test/Preprocessor/macro_paste_hashhash.c b/clang/test/Preprocessor/macro_paste_hashhash.c new file mode 100644 index 0000000..f4b03be --- /dev/null +++ b/clang/test/Preprocessor/macro_paste_hashhash.c @@ -0,0 +1,11 @@ +// RUN: %clang_cc1 -E %s | FileCheck %s +#define hash_hash # ## # +#define mkstr(a) # a +#define in_between(a) mkstr(a) +#define join(c, d) in_between(c hash_hash d) +// CHECK: "x ## y"; +join(x, y); + +#define FOO(x) A x B +// CHECK: A ## B; +FOO(##); diff --git a/clang/test/Preprocessor/macro_paste_msextensions.c b/clang/test/Preprocessor/macro_paste_msextensions.c new file mode 100644 index 0000000..c5b4213 --- /dev/null +++ b/clang/test/Preprocessor/macro_paste_msextensions.c @@ -0,0 +1,34 @@ +// RUN: %clang_cc1 -P -E -fms-extensions %s | FileCheck -strict-whitespace %s + +// This horrible stuff should preprocess into (other than whitespace): +// int foo; +// int bar; +// int baz; + +int foo; + +// CHECK: int foo; + +#define comment /##/ dead tokens live here +comment This is stupidity + +int bar; + +// CHECK: int bar; + +#define nested(x) int x comment cute little dead tokens... + +nested(baz) rise of the dead tokens + +; + +// CHECK: int baz +// CHECK: ; + + +// rdar://8197149 - VC++ allows invalid token pastes: (##baz +#define foo(x) abc(x) +#define bar(y) foo(##baz(y)) +bar(q) + +// CHECK: abc(baz(q)) diff --git a/clang/test/Preprocessor/macro_paste_none.c b/clang/test/Preprocessor/macro_paste_none.c new file mode 100644 index 0000000..97ccd7c --- /dev/null +++ b/clang/test/Preprocessor/macro_paste_none.c @@ -0,0 +1,6 @@ +// RUN: %clang_cc1 -E %s | grep '!!' + +#define A(B,C) B ## C + +!A(,)! + diff --git a/clang/test/Preprocessor/macro_paste_simple.c b/clang/test/Preprocessor/macro_paste_simple.c new file mode 100644 index 0000000..0e62ba4 --- /dev/null +++ b/clang/test/Preprocessor/macro_paste_simple.c @@ -0,0 +1,14 @@ +// RUN: %clang_cc1 %s -E | FileCheck %s + +#define FOO bar ## baz ## 123 + +// CHECK: A: barbaz123 +A: FOO + +// PR9981 +#define M1(A) A +#define M2(X) X +B: M1(M2(##)) + +// CHECK: B: ## + diff --git a/clang/test/Preprocessor/macro_paste_spacing.c b/clang/test/Preprocessor/macro_paste_spacing.c new file mode 100644 index 0000000..6498ffc --- /dev/null +++ b/clang/test/Preprocessor/macro_paste_spacing.c @@ -0,0 +1,7 @@ +// RUN: %clang_cc1 %s -E | grep "^xy$" + +#define A x ## y +blah + +A + diff --git a/clang/test/Preprocessor/macro_paste_spacing2.c b/clang/test/Preprocessor/macro_paste_spacing2.c new file mode 100644 index 0000000..02cc12f --- /dev/null +++ b/clang/test/Preprocessor/macro_paste_spacing2.c @@ -0,0 +1,6 @@ +// RUN: %clang_cc1 %s -E | grep "movl %eax" +// PR4132 +#define R1E %eax +#define epilogue(r1) movl r1 ## E; +epilogue(R1) + diff --git a/clang/test/Preprocessor/macro_rescan.c b/clang/test/Preprocessor/macro_rescan.c new file mode 100644 index 0000000..3a38548 --- /dev/null +++ b/clang/test/Preprocessor/macro_rescan.c @@ -0,0 +1,9 @@ +// RUN: %clang_cc1 -E %s | grep 'ei_1 = (17 +1);' +// RUN: %clang_cc1 -E %s | grep 'ei_2 = (M1)(17);' + +#define M1(a) (a+1) +#define M2(b) b + +int ei_1 = M2(M1)(17); /* becomes int ei_1 = (17+1); */ +int ei_2 = (M2(M1))(17); /* becomes int ei_2 = (M1)(17); */ + diff --git a/clang/test/Preprocessor/macro_rescan2.c b/clang/test/Preprocessor/macro_rescan2.c new file mode 100644 index 0000000..826f4ee --- /dev/null +++ b/clang/test/Preprocessor/macro_rescan2.c @@ -0,0 +1,15 @@ +// RUN: %clang_cc1 %s -E | grep 'a: 2\*f(9)' +// RUN: %clang_cc1 %s -E | grep 'b: 2\*9\*g' + +#define f(a) a*g +#define g f +a: f(2)(9) + +#undef f +#undef g + +#define f(a) a*g +#define g(a) f(a) + +b: f(2)(9) + diff --git a/clang/test/Preprocessor/macro_rescan_varargs.c b/clang/test/Preprocessor/macro_rescan_varargs.c new file mode 100644 index 0000000..6c6415a --- /dev/null +++ b/clang/test/Preprocessor/macro_rescan_varargs.c @@ -0,0 +1,13 @@ +// RUN: %clang_cc1 -E %s | FileCheck -strict-whitespace %s + +#define LPAREN ( +#define RPAREN ) +#define F(x, y) x + y +#define ELLIP_FUNC(...) __VA_ARGS__ + +1: ELLIP_FUNC(F, LPAREN, 'a', 'b', RPAREN); /* 1st invocation */ +2: ELLIP_FUNC(F LPAREN 'a', 'b' RPAREN); /* 2nd invocation */ + +// CHECK: 1: F, (, 'a', 'b', ); +// CHECK: 2: 'a' + 'b'; + diff --git a/clang/test/Preprocessor/macro_rparen_scan.c b/clang/test/Preprocessor/macro_rparen_scan.c new file mode 100644 index 0000000..e4de5db --- /dev/null +++ b/clang/test/Preprocessor/macro_rparen_scan.c @@ -0,0 +1,8 @@ +// RUN: %clang_cc1 -E %s | grep '^3 ;$' + +/* Right paren scanning, hard case. Should expand to 3. */ +#define i(x) 3 +#define a i(yz +#define b ) +a b ) ; + diff --git a/clang/test/Preprocessor/macro_rparen_scan2.c b/clang/test/Preprocessor/macro_rparen_scan2.c new file mode 100644 index 0000000..42aa544 --- /dev/null +++ b/clang/test/Preprocessor/macro_rparen_scan2.c @@ -0,0 +1,10 @@ +// RUN: %clang_cc1 -E %s | FileCheck -strict-whitespace %s + +#define R_PAREN ) + +#define FUNC(a) a + +static int glob = (1 + FUNC(1 R_PAREN ); + +// CHECK: static int glob = (1 + 1 ); + diff --git a/clang/test/Preprocessor/macro_space.c b/clang/test/Preprocessor/macro_space.c new file mode 100644 index 0000000..49a9a0f --- /dev/null +++ b/clang/test/Preprocessor/macro_space.c @@ -0,0 +1,5 @@ +// RUN: %clang_cc1 %s -E | grep '! ,' + +#define XX +! XX, + diff --git a/clang/test/Preprocessor/macro_undef.c b/clang/test/Preprocessor/macro_undef.c new file mode 100644 index 0000000..c842c85 --- /dev/null +++ b/clang/test/Preprocessor/macro_undef.c @@ -0,0 +1,4 @@ +// RUN: %clang_cc1 -dM -undef -Dfoo=1 -E %s | FileCheck %s + +// CHECK-NOT: #define __clang__ +// CHECK: #define foo 1 diff --git a/clang/test/Preprocessor/mi_opt.c b/clang/test/Preprocessor/mi_opt.c new file mode 100644 index 0000000..597ac07 --- /dev/null +++ b/clang/test/Preprocessor/mi_opt.c @@ -0,0 +1,11 @@ +// RUN: not %clang_cc1 -fsyntax-only %s +// PR1900 +// This test should get a redefinition error from m_iopt.h: the MI opt +// shouldn't apply. + +#define MACRO +#include "mi_opt.h" +#undef MACRO +#define MACRO || 1 +#include "mi_opt.h" + diff --git a/clang/test/Preprocessor/mi_opt.h b/clang/test/Preprocessor/mi_opt.h new file mode 100644 index 0000000..a82aa6a --- /dev/null +++ b/clang/test/Preprocessor/mi_opt.h @@ -0,0 +1,4 @@ +#if !defined foo MACRO +#define foo +int x = 2; +#endif diff --git a/clang/test/Preprocessor/mi_opt2.c b/clang/test/Preprocessor/mi_opt2.c new file mode 100644 index 0000000..198d19f --- /dev/null +++ b/clang/test/Preprocessor/mi_opt2.c @@ -0,0 +1,15 @@ +// RUN: %clang_cc1 -E %s | FileCheck %s +// PR6282 +// This test should not trigger the include guard optimization since +// the guard macro is defined on the first include. + +#define ITERATING 1 +#define X 1 +#include "mi_opt2.h" +#undef X +#define X 2 +#include "mi_opt2.h" + +// CHECK: b: 1 +// CHECK: b: 2 + diff --git a/clang/test/Preprocessor/mi_opt2.h b/clang/test/Preprocessor/mi_opt2.h new file mode 100644 index 0000000..df37eba --- /dev/null +++ b/clang/test/Preprocessor/mi_opt2.h @@ -0,0 +1,5 @@ +#ifndef ITERATING +a: X +#else +b: X +#endif diff --git a/clang/test/Preprocessor/microsoft-import.c b/clang/test/Preprocessor/microsoft-import.c new file mode 100644 index 0000000..8835c7a --- /dev/null +++ b/clang/test/Preprocessor/microsoft-import.c @@ -0,0 +1,17 @@ +// RUN: %clang_cc1 -E -fms-compatibility %s 2>&1 | grep 'doh.c:100:2: error: #import of type library is an unsupported Microsoft feature' +// RUN: %clang_cc1 -E -fms-compatibility %s 2>&1 | grep 'doh.c:200:2: error: #import of type library is an unsupported Microsoft feature' +// RUN: %clang_cc1 -E -fms-compatibility %s 2>&1 | grep 'doh.c:300:2: error: #import of type library is an unsupported Microsoft feature' + +#line 100 "doh.c" +#import "pp-record.h" // expected-error {{#import of type library is an unsupported Microsoft feature}} + +// Test attributes +#line 200 "doh.c" +#import "pp-record.h" no_namespace, auto_rename // expected-error {{#import of type library is an unsupported Microsoft feature}} + +// This will also fire the "#import of type library is an unsupported Microsoft feature" +// error, but we can't use -verify because there's no way to put the comment on the proper line +#line 300 "doh.c" +#import "pp-record.h" no_namespace \ + auto_rename \ + auto_search diff --git a/clang/test/Preprocessor/missing-system-header.c b/clang/test/Preprocessor/missing-system-header.c new file mode 100644 index 0000000..69cb131 --- /dev/null +++ b/clang/test/Preprocessor/missing-system-header.c @@ -0,0 +1,2 @@ +// RUN: %clang_cc1 -verify -fsyntax-only %s +#include "missing-system-header.h" diff --git a/clang/test/Preprocessor/missing-system-header.h b/clang/test/Preprocessor/missing-system-header.h new file mode 100644 index 0000000..393ab2b --- /dev/null +++ b/clang/test/Preprocessor/missing-system-header.h @@ -0,0 +1,2 @@ +#pragma clang system_header +#include "not exist" // expected-error {{file not found}} diff --git a/clang/test/Preprocessor/mmx.c b/clang/test/Preprocessor/mmx.c new file mode 100644 index 0000000..2613cb6 --- /dev/null +++ b/clang/test/Preprocessor/mmx.c @@ -0,0 +1,13 @@ +// RUN: %clang -march=i386 -m32 -E -dM %s -msse -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=SSE_AND_MMX +// RUN: %clang -march=i386 -m32 -E -dM %s -msse -mno-mmx -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=SSE_NO_MMX +// RUN: %clang -march=i386 -m32 -E -dM %s -mno-mmx -msse -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=SSE_NO_MMX + +// SSE_AND_MMX: #define __MMX__ +// SSE_AND_MMX: #define __SSE__ + +// SSE_NO_MMX-NOT: __MMX__ +// SSE_NO_MMX: __SSE__ +// SSE_NO_MMX-NOT: __MMX__ diff --git a/clang/test/Preprocessor/non_fragile_feature.m b/clang/test/Preprocessor/non_fragile_feature.m new file mode 100644 index 0000000..cf64df2 --- /dev/null +++ b/clang/test/Preprocessor/non_fragile_feature.m @@ -0,0 +1,12 @@ +// RUN: %clang_cc1 %s +#ifndef __has_feature +#error Should have __has_feature +#endif + +#if !__has_feature(objc_nonfragile_abi) +#error Non-fragile ABI used for compilation but feature macro not set. +#endif + +#if !__has_feature(objc_weak_class) +#error objc_weak_class should be enabled with nonfragile abi +#endif diff --git a/clang/test/Preprocessor/non_fragile_feature1.m b/clang/test/Preprocessor/non_fragile_feature1.m new file mode 100644 index 0000000..79cc488 --- /dev/null +++ b/clang/test/Preprocessor/non_fragile_feature1.m @@ -0,0 +1,8 @@ +// RUN: %clang_cc1 -triple i386-unknown-unknown -fobjc-fragile-abi %s +#ifndef __has_feature +#error Should have __has_feature +#endif + +#if __has_feature(objc_nonfragile_abi) +#error Non-fragile ABI not used for compilation but feature macro set. +#endif diff --git a/clang/test/Preprocessor/objc-pp.m b/clang/test/Preprocessor/objc-pp.m new file mode 100644 index 0000000..0ec288c --- /dev/null +++ b/clang/test/Preprocessor/objc-pp.m @@ -0,0 +1,4 @@ +// RUN: %clang_cc1 %s -fsyntax-only -verify -pedantic -ffreestanding + +#import // no warning on #import in objc mode. + diff --git a/clang/test/Preprocessor/optimize.c b/clang/test/Preprocessor/optimize.c new file mode 100644 index 0000000..97f841a --- /dev/null +++ b/clang/test/Preprocessor/optimize.c @@ -0,0 +1,29 @@ +// RUN: %clang_cc1 -Eonly %s -DOPT_O2 -O2 -verify +#ifdef OPT_O2 + #ifndef __OPTIMIZE__ + #error "__OPTIMIZE__ not defined" + #endif + #ifdef __OPTIMIZE_SIZE__ + #error "__OPTIMIZE_SIZE__ defined" + #endif +#endif + +// RUN: %clang_cc1 -Eonly %s -DOPT_O0 -O0 -verify +#ifdef OPT_O0 + #ifdef __OPTIMIZE__ + #error "__OPTIMIZE__ defined" + #endif + #ifdef __OPTIMIZE_SIZE__ + #error "__OPTIMIZE_SIZE__ defined" + #endif +#endif + +// RUN: %clang_cc1 -Eonly %s -DOPT_OS -Os -verify +#ifdef OPT_OS + #ifndef __OPTIMIZE__ + #error "__OPTIMIZE__ not defined" + #endif + #ifndef __OPTIMIZE_SIZE__ + #error "__OPTIMIZE_SIZE__ not defined" + #endif +#endif diff --git a/clang/test/Preprocessor/output_paste_avoid.c b/clang/test/Preprocessor/output_paste_avoid.c new file mode 100644 index 0000000..8e4f3a4 --- /dev/null +++ b/clang/test/Preprocessor/output_paste_avoid.c @@ -0,0 +1,33 @@ +// RUN: %clang_cc1 -E %s -o - | FileCheck -strict-whitespace %s + + +#define y(a) ..a +A: y(.) +// This should print as ".. ." to avoid turning into ... +// CHECK: A: .. . + +#define X 0 .. 1 +B: X +// CHECK: B: 0 .. 1 + +#define DOT . +C: ..DOT +// CHECK: C: .. . + + +#define PLUS + +#define EMPTY +#define f(x) =x= +D: +PLUS -EMPTY- PLUS+ f(=) +// CHECK: D: + + - - + + = = = + + +#define test(x) L#x +E: test(str) +// Should expand to L "str" not L"str" +// CHECK: E: L "str" + +// Should avoid producing >>=. +#define equal = +F: >>equal +// CHECK: F: >> = diff --git a/clang/test/Preprocessor/overflow.c b/clang/test/Preprocessor/overflow.c new file mode 100644 index 0000000..a921441 --- /dev/null +++ b/clang/test/Preprocessor/overflow.c @@ -0,0 +1,25 @@ +// RUN: %clang_cc1 -Eonly %s -verify -triple i686-pc-linux-gnu + +// Multiply signed overflow +#if 0x7FFFFFFFFFFFFFFF*2 // expected-warning {{overflow}} +#endif + +// Multiply unsigned overflow +#if 0xFFFFFFFFFFFFFFFF*2 +#endif + +// Add signed overflow +#if 0x7FFFFFFFFFFFFFFF+1 // expected-warning {{overflow}} +#endif + +// Add unsigned overflow +#if 0xFFFFFFFFFFFFFFFF+1 +#endif + +// Subtract signed overflow +#if 0x7FFFFFFFFFFFFFFF- -1 // expected-warning {{overflow}} +#endif + +// Subtract unsigned overflow +#if 0xFFFFFFFFFFFFFFFF- -1 // expected-warning {{converted from negative value}} +#endif diff --git a/clang/test/Preprocessor/pic.c b/clang/test/Preprocessor/pic.c new file mode 100644 index 0000000..3e649ee --- /dev/null +++ b/clang/test/Preprocessor/pic.c @@ -0,0 +1,34 @@ +// RUN: %clang_cc1 -dM -E -o - %s \ +// RUN: | FileCheck %s +// CHECK-NOT: #define __PIC__ +// CHECK-NOT: #define __PIE__ +// CHECK-NOT: #define __pic__ +// CHECK-NOT: #define __pie__ +// +// RUN: %clang_cc1 -pic-level 1 -dM -E -o - %s \ +// RUN: | FileCheck --check-prefix=CHECK-PIC1 %s +// CHECK-PIC1: #define __PIC__ 1 +// CHECK-PIC1-NOT: #define __PIE__ +// CHECK-PIC1: #define __pic__ 1 +// CHECK-PIC1-NOT: #define __pie__ +// +// RUN: %clang_cc1 -pic-level 2 -dM -E -o - %s \ +// RUN: | FileCheck --check-prefix=CHECK-PIC2 %s +// CHECK-PIC2: #define __PIC__ 2 +// CHECK-PIC2-NOT: #define __PIE__ +// CHECK-PIC2: #define __pic__ 2 +// CHECK-PIC2-NOT: #define __pie__ +// +// RUN: %clang_cc1 -pie-level 1 -dM -E -o - %s \ +// RUN: | FileCheck --check-prefix=CHECK-PIE1 %s +// CHECK-PIE1-NOT: #define __PIC__ +// CHECK-PIE1: #define __PIE__ 1 +// CHECK-PIE1-NOT: #define __pic__ +// CHECK-PIE1: #define __pie__ 1 +// +// RUN: %clang_cc1 -pie-level 2 -dM -E -o - %s \ +// RUN: | FileCheck --check-prefix=CHECK-PIE2 %s +// CHECK-PIE2-NOT: #define __PIC__ +// CHECK-PIE2: #define __PIE__ 2 +// CHECK-PIE2-NOT: #define __pic__ +// CHECK-PIE2: #define __pie__ 2 diff --git a/clang/test/Preprocessor/pp-record.c b/clang/test/Preprocessor/pp-record.c new file mode 100644 index 0000000..f098683 --- /dev/null +++ b/clang/test/Preprocessor/pp-record.c @@ -0,0 +1,12 @@ +// RUN: %clang_cc1 -fsyntax-only -detailed-preprocessing-record %s + +// http://llvm.org/PR11120 + +#define STRINGIZE(text) STRINGIZE_I(text) +#define STRINGIZE_I(text) #text + +#define INC pp-record.h + +#include STRINGIZE(INC) + +CAKE; diff --git a/clang/test/Preprocessor/pp-record.h b/clang/test/Preprocessor/pp-record.h new file mode 100644 index 0000000..b39a174 --- /dev/null +++ b/clang/test/Preprocessor/pp-record.h @@ -0,0 +1,3 @@ +// Only useful for #inclusion. + +#define CAKE extern int is_a_lie diff --git a/clang/test/Preprocessor/pr2086.c b/clang/test/Preprocessor/pr2086.c new file mode 100644 index 0000000..d438e87 --- /dev/null +++ b/clang/test/Preprocessor/pr2086.c @@ -0,0 +1,11 @@ +// RUN: %clang_cc1 -E %s + +#define test +#include "pr2086.h" +#define test +#include "pr2086.h" + +#ifdef test +#error +#endif + diff --git a/clang/test/Preprocessor/pr2086.h b/clang/test/Preprocessor/pr2086.h new file mode 100644 index 0000000..b98b996 --- /dev/null +++ b/clang/test/Preprocessor/pr2086.h @@ -0,0 +1,6 @@ +#ifndef test +#endif + +#ifdef test +#undef test +#endif diff --git a/clang/test/Preprocessor/pragma-pushpop-macro.c b/clang/test/Preprocessor/pragma-pushpop-macro.c new file mode 100644 index 0000000..08a6570 --- /dev/null +++ b/clang/test/Preprocessor/pragma-pushpop-macro.c @@ -0,0 +1,41 @@ +/* Test pragma pop_macro and push_macro directives from + http://msdn.microsoft.com/en-us/library/hsttss76.aspx */ + +// pop_macro: Sets the value of the macro_name macro to the value on the top of +// the stack for this macro. +// #pragma pop_macro("macro_name") +// push_macro: Saves the value of the macro_name macro on the top of the stack +// for this macro. +// #pragma push_macro("macro_name") +// +// RUN: %clang_cc1 -fms-extensions -E %s -o - | FileCheck %s + +#define X 1 +#define Y 2 +int pmx0 = X; +int pmy0 = Y; +#define Y 3 +#pragma push_macro("Y") +#pragma push_macro("X") +int pmx1 = X; +#define X 2 +int pmx2 = X; +#pragma pop_macro("X") +int pmx3 = X; +#pragma pop_macro("Y") +int pmy1 = Y; + +// Have a stray 'push' to show we don't crash when having imbalanced +// push/pop +#pragma push_macro("Y") +#define Y 4 +int pmy2 = Y; + +// CHECK: int pmx0 = 1 +// CHECK: int pmy0 = 2 +// CHECK: int pmx1 = 1 +// CHECK: int pmx2 = 2 +// CHECK: int pmx3 = 1 +// CHECK: int pmy1 = 3 +// CHECK: int pmy2 = 4 + diff --git a/clang/test/Preprocessor/pragma_diagnostic.c b/clang/test/Preprocessor/pragma_diagnostic.c new file mode 100644 index 0000000..818f02f --- /dev/null +++ b/clang/test/Preprocessor/pragma_diagnostic.c @@ -0,0 +1,32 @@ +// RUN: %clang_cc1 -fsyntax-only -verify -Wno-undef %s +// rdar://2362963 + +#if FOO // ok. +#endif + +#pragma GCC diagnostic warning "-Wundef" + +#if FOO // expected-warning {{'FOO' is not defined}} +#endif + +#pragma GCC diagnostic ignored "-Wun" "def" + +#if FOO // ok. +#endif + +#pragma GCC diagnostic error "-Wundef" + +#if FOO // expected-error {{'FOO' is not defined}} +#endif + + +#define foo error +#pragma GCC diagnostic foo "-Wundef" // expected-warning {{pragma diagnostic expected 'error', 'warning', 'ignored', 'fatal', 'push', or 'pop'}} + +#pragma GCC diagnostic error 42 // expected-warning {{unexpected token in pragma diagnostic}} + +#pragma GCC diagnostic error "-Wundef" 42 // expected-warning {{unexpected token in pragma diagnostic}} +#pragma GCC diagnostic error "invalid-name" // expected-warning {{pragma diagnostic expected option name (e.g. "-Wundef")}} + +#pragma GCC diagnostic error "-Winvalid-name" // expected-warning {{unknown warning group '-Winvalid-name', ignored}} + diff --git a/clang/test/Preprocessor/pragma_diagnostic_output.c b/clang/test/Preprocessor/pragma_diagnostic_output.c new file mode 100644 index 0000000..e847107 --- /dev/null +++ b/clang/test/Preprocessor/pragma_diagnostic_output.c @@ -0,0 +1,26 @@ +// RUN: %clang_cc1 -E %s | FileCheck %s +// CHECK: #pragma GCC diagnostic warning "-Wall" +#pragma GCC diagnostic warning "-Wall" +// CHECK: #pragma GCC diagnostic ignored "-Wall" +#pragma GCC diagnostic ignored "-Wall" +// CHECK: #pragma GCC diagnostic error "-Wall" +#pragma GCC diagnostic error "-Wall" +// CHECK: #pragma GCC diagnostic fatal "-Wall" +#pragma GCC diagnostic fatal "-Wall" +// CHECK: #pragma GCC diagnostic push +#pragma GCC diagnostic push +// CHECK: #pragma GCC diagnostic pop +#pragma GCC diagnostic pop + +// CHECK: #pragma clang diagnostic warning "-Wall" +#pragma clang diagnostic warning "-Wall" +// CHECK: #pragma clang diagnostic ignored "-Wall" +#pragma clang diagnostic ignored "-Wall" +// CHECK: #pragma clang diagnostic error "-Wall" +#pragma clang diagnostic error "-Wall" +// CHECK: #pragma clang diagnostic fatal "-Wall" +#pragma clang diagnostic fatal "-Wall" +// CHECK: #pragma clang diagnostic push +#pragma clang diagnostic push +// CHECK: #pragma clang diagnostic pop +#pragma clang diagnostic pop diff --git a/clang/test/Preprocessor/pragma_diagnostic_sections.cpp b/clang/test/Preprocessor/pragma_diagnostic_sections.cpp new file mode 100644 index 0000000..b680fae --- /dev/null +++ b/clang/test/Preprocessor/pragma_diagnostic_sections.cpp @@ -0,0 +1,80 @@ +// RUN: %clang_cc1 -fsyntax-only -Wall -Wunused-macros -Wunused-parameter -Wno-uninitialized -verify %s + +// rdar://8365684 +struct S { + void m1() { int b; while (b==b); } // expected-warning {{always evaluates to true}} + +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wtautological-compare" + void m2() { int b; while (b==b); } +#pragma clang diagnostic pop + + void m3() { int b; while (b==b); } // expected-warning {{always evaluates to true}} +}; + +//------------------------------------------------------------------------------ + +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wtautological-compare" +template +struct TS { + void m() { T b; while (b==b); } +}; +#pragma clang diagnostic pop + +void f() { + TS ts; + ts.m(); +} + +//------------------------------------------------------------------------------ + +#define UNUSED_MACRO1 // expected-warning {{macro is not used}} + +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wunused-macros" +#define UNUSED_MACRO2 +#pragma clang diagnostic pop + +//------------------------------------------------------------------------------ + +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wreturn-type" +int g() { } +#pragma clang diagnostic pop + +//------------------------------------------------------------------------------ + +void ww( +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wunused-parameter" + int x, +#pragma clang diagnostic pop + int y) // expected-warning {{unused}} +{ +} + +//------------------------------------------------------------------------------ + +struct S2 { + int x, y; + S2() : +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wreorder" + y(), + x() +#pragma clang diagnostic pop + {} +}; + +//------------------------------------------------------------------------------ + +// rdar://8790245 +#define MYMACRO \ + _Pragma("clang diagnostic push") \ + _Pragma("clang diagnostic ignored \"-Wunknown-pragmas\"") \ + _Pragma("clang diagnostic pop") +MYMACRO +#undef MYMACRO + +//------------------------------------------------------------------------------ diff --git a/clang/test/Preprocessor/pragma_microsoft.c b/clang/test/Preprocessor/pragma_microsoft.c new file mode 100644 index 0000000..e461c70 --- /dev/null +++ b/clang/test/Preprocessor/pragma_microsoft.c @@ -0,0 +1,83 @@ +// RUN: %clang_cc1 %s -fsyntax-only -verify -fms-extensions + +// rdar://6495941 + +#define FOO 1 +#define BAR "2" + +#pragma comment(linker,"foo=" FOO) // expected-error {{pragma comment requires parenthesized identifier and optional string}} +#pragma comment(linker," bar=" BAR) + +#pragma comment( user, "Compiled on " __DATE__ " at " __TIME__ ) + +#pragma comment(foo) // expected-error {{unknown kind of pragma comment}} +#pragma comment(compiler,) // expected-error {{pragma comment requires}} +#define foo compiler +#pragma comment(foo) // macro expand kind. +#pragma comment(foo) x // expected-error {{pragma comment requires}} + +#pragma comment(user, "foo\abar\nbaz\tsome thing") + + +// __pragma + +__pragma(comment(linker," bar=" BAR)) + +#define MACRO_WITH__PRAGMA { \ + __pragma(warning(push)); \ + __pragma(warning(disable: 10000)); \ + 2+2; \ + __pragma(warning(pop)); \ +} + +void f() +{ + __pragma() + + // If we ever actually *support* __pragma(warning(disable: x)), + // this warning should go away. + MACRO_WITH__PRAGMA // expected-warning {{expression result unused}} +} + + +// This should include macro_arg_directive even though the include +// is looking for test.h This allows us to assign to "n" +#pragma include_alias("test.h", "macro_arg_directive.h" ) +#include "test.h" +void test( void ) { + n = 12; +} + +#pragma include_alias(, "bar.h") // expected-warning {{angle-bracketed include cannot be aliased to double-quoted include "bar.h"}} +#pragma include_alias("foo.h", ) // expected-warning {{double-quoted include "foo.h" cannot be aliased to angle-bracketed include }} +#pragma include_alias("test.h") // expected-warning {{pragma include_alias expected ','}} + +// Make sure that the names match exactly for a replacement, including path information. If +// this were to fail, we would get a file not found error +#pragma include_alias(".\pp-record.h", "does_not_exist.h") +#include "pp-record.h" + +#pragma include_alias(12) // expected-warning {{pragma include_alias expected include filename}} + +// It's expected that we can map "bar" and separately +#define test +// We can't actually look up stdio.h because we're using cc1 without header paths, but this will ensure +// that we get the right bar.h, because the "bar.h" will undef test for us, where won't +#pragma include_alias(, ) +#pragma include_alias("bar.h", "pr2086.h") // This should #undef test + +#include "bar.h" +#if defined(test) +// This should not warn because test should not be defined +#pragma include_alias("test.h") +#endif + +// Test to make sure there are no use-after-free problems +#define B "pp-record.h" +#pragma include_alias("quux.h", B) +void g() {} +#include "quux.h" + +// Make sure that empty includes don't work +#pragma include_alias("", "foo.h") // expected-error {{empty filename}} +#pragma include_alias(, <>) // expected-error {{empty filename}} diff --git a/clang/test/Preprocessor/pragma_poison.c b/clang/test/Preprocessor/pragma_poison.c new file mode 100644 index 0000000..5b39183 --- /dev/null +++ b/clang/test/Preprocessor/pragma_poison.c @@ -0,0 +1,20 @@ +// RUN: %clang_cc1 %s -Eonly -verify + +#pragma GCC poison rindex +rindex(some_string, 'h'); // expected-error {{attempt to use a poisoned identifier}} + +#define BAR _Pragma ("GCC poison XYZW") XYZW /*NO ERROR*/ + XYZW // ok +BAR + XYZW // expected-error {{attempt to use a poisoned identifier}} + +// Pragma poison shouldn't warn from macro expansions defined before the token +// is poisoned. + +#define strrchr rindex2 +#pragma GCC poison rindex2 + +// Can poison multiple times. +#pragma GCC poison rindex2 + +strrchr(some_string, 'h'); // ok. diff --git a/clang/test/Preprocessor/pragma_sysheader.c b/clang/test/Preprocessor/pragma_sysheader.c new file mode 100644 index 0000000..17080fe --- /dev/null +++ b/clang/test/Preprocessor/pragma_sysheader.c @@ -0,0 +1,12 @@ +// RUN: %clang_cc1 -verify -pedantic %s -fsyntax-only +// RUN: %clang_cc1 -E %s | FileCheck %s +// rdar://6899937 +#include "pragma_sysheader.h" + + +// PR9861: Verify that line markers are not messed up in -E mode. +// CHECK: # 1 "{{.*}}pragma_sysheader.h" 1 +// CHECK-NEXT: # 1 "{{.*}}pragma_sysheader.h" 3 +// CHECK-NEXT: typedef int x; +// CHECK-NEXT: typedef int x; +// CHECK-NEXT: # 5 "{{.*}}pragma_sysheader.c" 2 diff --git a/clang/test/Preprocessor/pragma_sysheader.h b/clang/test/Preprocessor/pragma_sysheader.h new file mode 100644 index 0000000..b79bde5 --- /dev/null +++ b/clang/test/Preprocessor/pragma_sysheader.h @@ -0,0 +1,4 @@ +#pragma GCC system_header +typedef int x; +typedef int x; + diff --git a/clang/test/Preprocessor/pragma_unknown.c b/clang/test/Preprocessor/pragma_unknown.c new file mode 100644 index 0000000..2586754 --- /dev/null +++ b/clang/test/Preprocessor/pragma_unknown.c @@ -0,0 +1,28 @@ +// RUN: %clang_cc1 -E %s | grep '#pragma foo bar' +// RUN: %clang_cc1 -fsyntax-only -Wunknown-pragmas -verify %s + +// GCC doesn't expand macro args for unrecognized pragmas. +#define bar xX +#pragma foo bar // expected-warning {{unknown pragma ignored}} + +#pragma STDC FP_CONTRACT ON +#pragma STDC FP_CONTRACT OFF +#pragma STDC FP_CONTRACT DEFAULT +#pragma STDC FP_CONTRACT IN_BETWEEN // expected-warning {{expected 'ON' or 'OFF' or 'DEFAULT' in pragma}} + +#pragma STDC FENV_ACCESS ON // expected-warning {{pragma STDC FENV_ACCESS ON is not supported, ignoring pragma}} +#pragma STDC FENV_ACCESS OFF +#pragma STDC FENV_ACCESS DEFAULT +#pragma STDC FENV_ACCESS IN_BETWEEN // expected-warning {{expected 'ON' or 'OFF' or 'DEFAULT' in pragma}} + +#pragma STDC CX_LIMITED_RANGE ON +#pragma STDC CX_LIMITED_RANGE OFF +#pragma STDC CX_LIMITED_RANGE DEFAULT +#pragma STDC CX_LIMITED_RANGE IN_BETWEEN // expected-warning {{expected 'ON' or 'OFF' or 'DEFAULT' in pragma}} + +#pragma STDC CX_LIMITED_RANGE // expected-warning {{expected 'ON' or 'OFF' or 'DEFAULT' in pragma}} +#pragma STDC CX_LIMITED_RANGE ON FULL POWER // expected-warning {{expected end of directive in pragma}} + +#pragma STDC SO_GREAT // expected-warning {{unknown pragma in STDC namespace}} +#pragma STDC // expected-warning {{unknown pragma in STDC namespace}} + diff --git a/clang/test/Preprocessor/predefined-arch-macros.c b/clang/test/Preprocessor/predefined-arch-macros.c new file mode 100644 index 0000000..b063f7f --- /dev/null +++ b/clang/test/Preprocessor/predefined-arch-macros.c @@ -0,0 +1,866 @@ +// These tests are generated by running utils/generate_arch_predefine_tests.sh +// to observe GCC's behavior (or some other system compiler's behavior). +// +// Begin X86/GCC/Linux tests ---------------- +// +// RUN: %clang -march=i386 -m32 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_I386_M32 +// CHECK_I386_M32: #define __i386 1 +// CHECK_I386_M32: #define __i386__ 1 +// CHECK_I386_M32: #define __tune_i386__ 1 +// CHECK_I386_M32: #define i386 1 +// RUN: %clang -march=i386 -m64 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_I386_M64 +// CHECK_I386_M64: error: +// +// RUN: %clang -march=i486 -m32 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_I486_M32 +// CHECK_I486_M32: #define __i386 1 +// CHECK_I486_M32: #define __i386__ 1 +// CHECK_I486_M32: #define __i486 1 +// CHECK_I486_M32: #define __i486__ 1 +// CHECK_I486_M32: #define __tune_i486__ 1 +// CHECK_I486_M32: #define i386 1 +// RUN: %clang -march=i486 -m64 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_I486_M64 +// CHECK_I486_M64: error: +// +// RUN: %clang -march=i586 -m32 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_I586_M32 +// CHECK_I586_M32: #define __i386 1 +// CHECK_I586_M32: #define __i386__ 1 +// CHECK_I586_M32: #define __i586 1 +// CHECK_I586_M32: #define __i586__ 1 +// CHECK_I586_M32: #define __pentium 1 +// CHECK_I586_M32: #define __pentium__ 1 +// CHECK_I586_M32: #define __tune_i586__ 1 +// CHECK_I586_M32: #define __tune_pentium__ 1 +// CHECK_I586_M32: #define i386 1 +// RUN: %clang -march=i586 -m64 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_I586_M64 +// CHECK_I586_M64: error: +// +// RUN: %clang -march=pentium -m32 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_PENTIUM_M32 +// CHECK_PENTIUM_M32: #define __i386 1 +// CHECK_PENTIUM_M32: #define __i386__ 1 +// CHECK_PENTIUM_M32: #define __i586 1 +// CHECK_PENTIUM_M32: #define __i586__ 1 +// CHECK_PENTIUM_M32: #define __pentium 1 +// CHECK_PENTIUM_M32: #define __pentium__ 1 +// CHECK_PENTIUM_M32: #define __tune_i586__ 1 +// CHECK_PENTIUM_M32: #define __tune_pentium__ 1 +// CHECK_PENTIUM_M32: #define i386 1 +// RUN: %clang -march=pentium -m64 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_PENTIUM_M64 +// CHECK_PENTIUM_M64: error: +// +// RUN: %clang -march=pentium-mmx -m32 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_PENTIUM_MMX_M32 +// CHECK_PENTIUM_MMX_M32: #define __MMX__ 1 +// CHECK_PENTIUM_MMX_M32: #define __i386 1 +// CHECK_PENTIUM_MMX_M32: #define __i386__ 1 +// CHECK_PENTIUM_MMX_M32: #define __i586 1 +// CHECK_PENTIUM_MMX_M32: #define __i586__ 1 +// CHECK_PENTIUM_MMX_M32: #define __pentium 1 +// CHECK_PENTIUM_MMX_M32: #define __pentium__ 1 +// CHECK_PENTIUM_MMX_M32: #define __pentium_mmx__ 1 +// CHECK_PENTIUM_MMX_M32: #define __tune_i586__ 1 +// CHECK_PENTIUM_MMX_M32: #define __tune_pentium__ 1 +// CHECK_PENTIUM_MMX_M32: #define __tune_pentium_mmx__ 1 +// CHECK_PENTIUM_MMX_M32: #define i386 1 +// RUN: %clang -march=pentium-mmx -m64 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_PENTIUM_MMX_M64 +// CHECK_PENTIUM_MMX_M64: error: +// +// RUN: %clang -march=winchip-c6 -m32 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_WINCHIP_C6_M32 +// CHECK_WINCHIP_C6_M32: #define __MMX__ 1 +// CHECK_WINCHIP_C6_M32: #define __i386 1 +// CHECK_WINCHIP_C6_M32: #define __i386__ 1 +// CHECK_WINCHIP_C6_M32: #define __i486 1 +// CHECK_WINCHIP_C6_M32: #define __i486__ 1 +// CHECK_WINCHIP_C6_M32: #define __tune_i486__ 1 +// CHECK_WINCHIP_C6_M32: #define i386 1 +// RUN: %clang -march=winchip-c6 -m64 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_WINCHIP_C6_M64 +// CHECK_WINCHIP_C6_M64: error: +// +// RUN: %clang -march=winchip2 -m32 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_WINCHIP2_M32 +// CHECK_WINCHIP2_M32: #define __3dNOW__ 1 +// CHECK_WINCHIP2_M32: #define __MMX__ 1 +// CHECK_WINCHIP2_M32: #define __i386 1 +// CHECK_WINCHIP2_M32: #define __i386__ 1 +// CHECK_WINCHIP2_M32: #define __i486 1 +// CHECK_WINCHIP2_M32: #define __i486__ 1 +// CHECK_WINCHIP2_M32: #define __tune_i486__ 1 +// CHECK_WINCHIP2_M32: #define i386 1 +// RUN: %clang -march=winchip2 -m64 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_WINCHIP2_M64 +// CHECK_WINCHIP2_M64: error: +// +// RUN: %clang -march=c3 -m32 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_C3_M32 +// CHECK_C3_M32: #define __3dNOW__ 1 +// CHECK_C3_M32: #define __MMX__ 1 +// CHECK_C3_M32: #define __i386 1 +// CHECK_C3_M32: #define __i386__ 1 +// CHECK_C3_M32: #define __i486 1 +// CHECK_C3_M32: #define __i486__ 1 +// CHECK_C3_M32: #define __tune_i486__ 1 +// CHECK_C3_M32: #define i386 1 +// RUN: %clang -march=c3 -m64 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_C3_M64 +// CHECK_C3_M64: error: +// +// RUN: %clang -march=c3-2 -m32 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_C3_2_M32 +// CHECK_C3_2_M32: #define __MMX__ 1 +// CHECK_C3_2_M32: #define __SSE__ 1 +// CHECK_C3_2_M32: #define __i386 1 +// CHECK_C3_2_M32: #define __i386__ 1 +// CHECK_C3_2_M32: #define __i686 1 +// CHECK_C3_2_M32: #define __i686__ 1 +// CHECK_C3_2_M32: #define __pentiumpro 1 +// CHECK_C3_2_M32: #define __pentiumpro__ 1 +// CHECK_C3_2_M32: #define __tune_i686__ 1 +// CHECK_C3_2_M32: #define __tune_pentium2__ 1 +// CHECK_C3_2_M32: #define __tune_pentiumpro__ 1 +// CHECK_C3_2_M32: #define i386 1 +// RUN: %clang -march=c3-2 -m64 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_C3_2_M64 +// CHECK_C3_2_M64: error: +// +// RUN: %clang -march=i686 -m32 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_I686_M32 +// CHECK_I686_M32: #define __i386 1 +// CHECK_I686_M32: #define __i386__ 1 +// CHECK_I686_M32: #define __i686 1 +// CHECK_I686_M32: #define __i686__ 1 +// CHECK_I686_M32: #define __pentiumpro 1 +// CHECK_I686_M32: #define __pentiumpro__ 1 +// CHECK_I686_M32: #define i386 1 +// RUN: %clang -march=i686 -m64 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_I686_M64 +// CHECK_I686_M64: error: +// +// RUN: %clang -march=pentiumpro -m32 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_PENTIUMPRO_M32 +// CHECK_PENTIUMPRO_M32: #define __i386 1 +// CHECK_PENTIUMPRO_M32: #define __i386__ 1 +// CHECK_PENTIUMPRO_M32: #define __i686 1 +// CHECK_PENTIUMPRO_M32: #define __i686__ 1 +// CHECK_PENTIUMPRO_M32: #define __pentiumpro 1 +// CHECK_PENTIUMPRO_M32: #define __pentiumpro__ 1 +// CHECK_PENTIUMPRO_M32: #define __tune_i686__ 1 +// CHECK_PENTIUMPRO_M32: #define __tune_pentiumpro__ 1 +// CHECK_PENTIUMPRO_M32: #define i386 1 +// RUN: %clang -march=pentiumpro -m64 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_PENTIUMPRO_M64 +// CHECK_PENTIUMPRO_M64: error: +// +// RUN: %clang -march=pentium2 -m32 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_PENTIUM2_M32 +// CHECK_PENTIUM2_M32: #define __MMX__ 1 +// CHECK_PENTIUM2_M32: #define __i386 1 +// CHECK_PENTIUM2_M32: #define __i386__ 1 +// CHECK_PENTIUM2_M32: #define __i686 1 +// CHECK_PENTIUM2_M32: #define __i686__ 1 +// CHECK_PENTIUM2_M32: #define __pentiumpro 1 +// CHECK_PENTIUM2_M32: #define __pentiumpro__ 1 +// CHECK_PENTIUM2_M32: #define __tune_i686__ 1 +// CHECK_PENTIUM2_M32: #define __tune_pentium2__ 1 +// CHECK_PENTIUM2_M32: #define __tune_pentiumpro__ 1 +// CHECK_PENTIUM2_M32: #define i386 1 +// RUN: %clang -march=pentium2 -m64 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_PENTIUM2_M64 +// CHECK_PENTIUM2_M64: error: +// +// RUN: %clang -march=pentium3 -m32 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_PENTIUM3_M32 +// CHECK_PENTIUM3_M32: #define __MMX__ 1 +// CHECK_PENTIUM3_M32: #define __SSE__ 1 +// CHECK_PENTIUM3_M32: #define __i386 1 +// CHECK_PENTIUM3_M32: #define __i386__ 1 +// CHECK_PENTIUM3_M32: #define __i686 1 +// CHECK_PENTIUM3_M32: #define __i686__ 1 +// CHECK_PENTIUM3_M32: #define __pentiumpro 1 +// CHECK_PENTIUM3_M32: #define __pentiumpro__ 1 +// CHECK_PENTIUM3_M32: #define __tune_i686__ 1 +// CHECK_PENTIUM3_M32: #define __tune_pentium2__ 1 +// CHECK_PENTIUM3_M32: #define __tune_pentium3__ 1 +// CHECK_PENTIUM3_M32: #define __tune_pentiumpro__ 1 +// CHECK_PENTIUM3_M32: #define i386 1 +// RUN: %clang -march=pentium3 -m64 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_PENTIUM3_M64 +// CHECK_PENTIUM3_M64: error: +// +// RUN: %clang -march=pentium3m -m32 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_PENTIUM3M_M32 +// CHECK_PENTIUM3M_M32: #define __MMX__ 1 +// CHECK_PENTIUM3M_M32: #define __SSE__ 1 +// CHECK_PENTIUM3M_M32: #define __i386 1 +// CHECK_PENTIUM3M_M32: #define __i386__ 1 +// CHECK_PENTIUM3M_M32: #define __i686 1 +// CHECK_PENTIUM3M_M32: #define __i686__ 1 +// CHECK_PENTIUM3M_M32: #define __pentiumpro 1 +// CHECK_PENTIUM3M_M32: #define __pentiumpro__ 1 +// CHECK_PENTIUM3M_M32: #define __tune_i686__ 1 +// CHECK_PENTIUM3M_M32: #define __tune_pentiumpro__ 1 +// CHECK_PENTIUM3M_M32: #define i386 1 +// RUN: %clang -march=pentium3m -m64 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_PENTIUM3M_M64 +// CHECK_PENTIUM3M_M64: error: +// +// RUN: %clang -march=pentium-m -m32 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_PENTIUM_M_M32 +// CHECK_PENTIUM_M_M32: #define __MMX__ 1 +// CHECK_PENTIUM_M_M32: #define __SSE2__ 1 +// CHECK_PENTIUM_M_M32: #define __SSE__ 1 +// CHECK_PENTIUM_M_M32: #define __i386 1 +// CHECK_PENTIUM_M_M32: #define __i386__ 1 +// CHECK_PENTIUM_M_M32: #define __i686 1 +// CHECK_PENTIUM_M_M32: #define __i686__ 1 +// CHECK_PENTIUM_M_M32: #define __pentiumpro 1 +// CHECK_PENTIUM_M_M32: #define __pentiumpro__ 1 +// CHECK_PENTIUM_M_M32: #define __tune_i686__ 1 +// CHECK_PENTIUM_M_M32: #define __tune_pentiumpro__ 1 +// CHECK_PENTIUM_M_M32: #define i386 1 +// RUN: %clang -march=pentium-m -m64 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_PENTIUM_M_M64 +// CHECK_PENTIUM_M_M64: error: +// +// RUN: %clang -march=pentium4 -m32 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_PENTIUM4_M32 +// CHECK_PENTIUM4_M32: #define __MMX__ 1 +// CHECK_PENTIUM4_M32: #define __SSE2__ 1 +// CHECK_PENTIUM4_M32: #define __SSE__ 1 +// CHECK_PENTIUM4_M32: #define __i386 1 +// CHECK_PENTIUM4_M32: #define __i386__ 1 +// CHECK_PENTIUM4_M32: #define __pentium4 1 +// CHECK_PENTIUM4_M32: #define __pentium4__ 1 +// CHECK_PENTIUM4_M32: #define __tune_pentium4__ 1 +// CHECK_PENTIUM4_M32: #define i386 1 +// RUN: %clang -march=pentium4 -m64 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_PENTIUM4_M64 +// CHECK_PENTIUM4_M64: error: +// +// RUN: %clang -march=pentium4m -m32 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_PENTIUM4M_M32 +// CHECK_PENTIUM4M_M32: #define __MMX__ 1 +// CHECK_PENTIUM4M_M32: #define __SSE2__ 1 +// CHECK_PENTIUM4M_M32: #define __SSE__ 1 +// CHECK_PENTIUM4M_M32: #define __i386 1 +// CHECK_PENTIUM4M_M32: #define __i386__ 1 +// CHECK_PENTIUM4M_M32: #define __pentium4 1 +// CHECK_PENTIUM4M_M32: #define __pentium4__ 1 +// CHECK_PENTIUM4M_M32: #define __tune_pentium4__ 1 +// CHECK_PENTIUM4M_M32: #define i386 1 +// RUN: %clang -march=pentium4m -m64 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_PENTIUM4M_M64 +// CHECK_PENTIUM4M_M64: error: +// +// RUN: %clang -march=prescott -m32 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_PRESCOTT_M32 +// CHECK_PRESCOTT_M32: #define __MMX__ 1 +// CHECK_PRESCOTT_M32: #define __SSE2__ 1 +// CHECK_PRESCOTT_M32: #define __SSE3__ 1 +// CHECK_PRESCOTT_M32: #define __SSE__ 1 +// CHECK_PRESCOTT_M32: #define __i386 1 +// CHECK_PRESCOTT_M32: #define __i386__ 1 +// CHECK_PRESCOTT_M32: #define __nocona 1 +// CHECK_PRESCOTT_M32: #define __nocona__ 1 +// CHECK_PRESCOTT_M32: #define __tune_nocona__ 1 +// CHECK_PRESCOTT_M32: #define i386 1 +// RUN: %clang -march=prescott -m64 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_PRESCOTT_M64 +// CHECK_PRESCOTT_M64: error: +// +// RUN: %clang -march=nocona -m32 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_NOCONA_M32 +// CHECK_NOCONA_M32: #define __MMX__ 1 +// CHECK_NOCONA_M32: #define __SSE2__ 1 +// CHECK_NOCONA_M32: #define __SSE3__ 1 +// CHECK_NOCONA_M32: #define __SSE__ 1 +// CHECK_NOCONA_M32: #define __i386 1 +// CHECK_NOCONA_M32: #define __i386__ 1 +// CHECK_NOCONA_M32: #define __nocona 1 +// CHECK_NOCONA_M32: #define __nocona__ 1 +// CHECK_NOCONA_M32: #define __tune_nocona__ 1 +// CHECK_NOCONA_M32: #define i386 1 +// RUN: %clang -march=nocona -m64 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_NOCONA_M64 +// CHECK_NOCONA_M64: #define __MMX__ 1 +// CHECK_NOCONA_M64: #define __SSE2_MATH__ 1 +// CHECK_NOCONA_M64: #define __SSE2__ 1 +// CHECK_NOCONA_M64: #define __SSE3__ 1 +// CHECK_NOCONA_M64: #define __SSE_MATH__ 1 +// CHECK_NOCONA_M64: #define __SSE__ 1 +// CHECK_NOCONA_M64: #define __amd64 1 +// CHECK_NOCONA_M64: #define __amd64__ 1 +// CHECK_NOCONA_M64: #define __nocona 1 +// CHECK_NOCONA_M64: #define __nocona__ 1 +// CHECK_NOCONA_M64: #define __tune_nocona__ 1 +// CHECK_NOCONA_M64: #define __x86_64 1 +// CHECK_NOCONA_M64: #define __x86_64__ 1 +// +// RUN: %clang -march=core2 -m32 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_CORE2_M32 +// CHECK_CORE2_M32: #define __MMX__ 1 +// CHECK_CORE2_M32: #define __SSE2__ 1 +// CHECK_CORE2_M32: #define __SSE3__ 1 +// CHECK_CORE2_M32: #define __SSE__ 1 +// CHECK_CORE2_M32: #define __SSSE3__ 1 +// CHECK_CORE2_M32: #define __core2 1 +// CHECK_CORE2_M32: #define __core2__ 1 +// CHECK_CORE2_M32: #define __i386 1 +// CHECK_CORE2_M32: #define __i386__ 1 +// CHECK_CORE2_M32: #define __tune_core2__ 1 +// CHECK_CORE2_M32: #define i386 1 +// RUN: %clang -march=core2 -m64 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_CORE2_M64 +// CHECK_CORE2_M64: #define __MMX__ 1 +// CHECK_CORE2_M64: #define __SSE2_MATH__ 1 +// CHECK_CORE2_M64: #define __SSE2__ 1 +// CHECK_CORE2_M64: #define __SSE3__ 1 +// CHECK_CORE2_M64: #define __SSE_MATH__ 1 +// CHECK_CORE2_M64: #define __SSE__ 1 +// CHECK_CORE2_M64: #define __SSSE3__ 1 +// CHECK_CORE2_M64: #define __amd64 1 +// CHECK_CORE2_M64: #define __amd64__ 1 +// CHECK_CORE2_M64: #define __core2 1 +// CHECK_CORE2_M64: #define __core2__ 1 +// CHECK_CORE2_M64: #define __tune_core2__ 1 +// CHECK_CORE2_M64: #define __x86_64 1 +// CHECK_CORE2_M64: #define __x86_64__ 1 +// +// RUN: %clang -march=corei7 -m32 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_COREI7_M32 +// CHECK_COREI7_M32: #define __MMX__ 1 +// CHECK_COREI7_M32: #define __SSE2__ 1 +// CHECK_COREI7_M32: #define __SSE3__ 1 +// CHECK_COREI7_M32: #define __SSE4_1__ 1 +// CHECK_COREI7_M32: #define __SSE4_2__ 1 +// CHECK_COREI7_M32: #define __SSE__ 1 +// CHECK_COREI7_M32: #define __SSSE3__ 1 +// CHECK_COREI7_M32: #define __corei7 1 +// CHECK_COREI7_M32: #define __corei7__ 1 +// CHECK_COREI7_M32: #define __i386 1 +// CHECK_COREI7_M32: #define __i386__ 1 +// CHECK_COREI7_M32: #define __tune_corei7__ 1 +// CHECK_COREI7_M32: #define i386 1 +// RUN: %clang -march=corei7 -m64 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_COREI7_M64 +// CHECK_COREI7_M64: #define __MMX__ 1 +// CHECK_COREI7_M64: #define __SSE2_MATH__ 1 +// CHECK_COREI7_M64: #define __SSE2__ 1 +// CHECK_COREI7_M64: #define __SSE3__ 1 +// CHECK_COREI7_M64: #define __SSE4_1__ 1 +// CHECK_COREI7_M64: #define __SSE4_2__ 1 +// CHECK_COREI7_M64: #define __SSE_MATH__ 1 +// CHECK_COREI7_M64: #define __SSE__ 1 +// CHECK_COREI7_M64: #define __SSSE3__ 1 +// CHECK_COREI7_M64: #define __amd64 1 +// CHECK_COREI7_M64: #define __amd64__ 1 +// CHECK_COREI7_M64: #define __corei7 1 +// CHECK_COREI7_M64: #define __corei7__ 1 +// CHECK_COREI7_M64: #define __tune_corei7__ 1 +// CHECK_COREI7_M64: #define __x86_64 1 +// CHECK_COREI7_M64: #define __x86_64__ 1 +// +// RUN: %clang -march=corei7-avx -m32 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_COREI7_AVX_M32 +// CHECK_COREI7_AVX_M32: #define __AES__ 1 +// FIXME: AVX is not yet enabled with Clang. +// CHECK_COREI7_AVX_M32-NOT: #define __AVX__ 1 +// CHECK_COREI7_AVX_M32: #define __MMX__ 1 +// CHECK_COREI7_AVX_M32: #define __SSE2__ 1 +// CHECK_COREI7_AVX_M32: #define __SSE3__ 1 +// CHECK_COREI7_AVX_M32: #define __SSE4_1__ 1 +// CHECK_COREI7_AVX_M32: #define __SSE4_2__ 1 +// CHECK_COREI7_AVX_M32: #define __SSE__ 1 +// CHECK_COREI7_AVX_M32: #define __SSSE3__ 1 +// CHECK_COREI7_AVX_M32: #define __corei7 1 +// CHECK_COREI7_AVX_M32: #define __corei7__ 1 +// CHECK_COREI7_AVX_M32: #define __i386 1 +// CHECK_COREI7_AVX_M32: #define __i386__ 1 +// CHECK_COREI7_AVX_M32: #define __tune_corei7__ 1 +// CHECK_COREI7_AVX_M32: #define i386 1 +// RUN: %clang -march=corei7-avx -m64 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_COREI7_AVX_M64 +// CHECK_COREI7_AVX_M64: #define __AES__ 1 +// FIXME: AVX is not yet enabled with Clang. +// CHECK_COREI7_AVX_M64-NOT: #define __AVX__ 1 +// CHECK_COREI7_AVX_M64: #define __MMX__ 1 +// CHECK_COREI7_AVX_M64: #define __SSE2_MATH__ 1 +// CHECK_COREI7_AVX_M64: #define __SSE2__ 1 +// CHECK_COREI7_AVX_M64: #define __SSE3__ 1 +// CHECK_COREI7_AVX_M64: #define __SSE4_1__ 1 +// CHECK_COREI7_AVX_M64: #define __SSE4_2__ 1 +// CHECK_COREI7_AVX_M64: #define __SSE_MATH__ 1 +// CHECK_COREI7_AVX_M64: #define __SSE__ 1 +// CHECK_COREI7_AVX_M64: #define __SSSE3__ 1 +// CHECK_COREI7_AVX_M64: #define __amd64 1 +// CHECK_COREI7_AVX_M64: #define __amd64__ 1 +// CHECK_COREI7_AVX_M64: #define __corei7 1 +// CHECK_COREI7_AVX_M64: #define __corei7__ 1 +// CHECK_COREI7_AVX_M64: #define __tune_corei7__ 1 +// CHECK_COREI7_AVX_M64: #define __x86_64 1 +// CHECK_COREI7_AVX_M64: #define __x86_64__ 1 +// +// RUN: %clang -march=core-avx-i -m32 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_CORE_AVX_I_M32 +// CHECK_CORE_AVX_I_M32: #define __AES__ 1 +// FIXME: AVX is not yet enabled with Clang. +// CHECK_CORE_AVX_I_M32-NOT: #define __AVX__ 1 +// CHECK_CORE_AVX_I_M32: #define __MMX__ 1 +// CHECK_CORE_AVX_I_M32: #define __SSE2__ 1 +// CHECK_CORE_AVX_I_M32: #define __SSE3__ 1 +// CHECK_CORE_AVX_I_M32: #define __SSE4_1__ 1 +// CHECK_CORE_AVX_I_M32: #define __SSE4_2__ 1 +// CHECK_CORE_AVX_I_M32: #define __SSE__ 1 +// CHECK_CORE_AVX_I_M32: #define __SSSE3__ 1 +// CHECK_CORE_AVX_I_M32: #define __corei7 1 +// CHECK_CORE_AVX_I_M32: #define __corei7__ 1 +// CHECK_CORE_AVX_I_M32: #define __i386 1 +// CHECK_CORE_AVX_I_M32: #define __i386__ 1 +// CHECK_CORE_AVX_I_M32: #define __tune_corei7__ 1 +// CHECK_CORE_AVX_I_M32: #define i386 1 +// RUN: %clang -march=core-avx-i -m64 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_CORE_AVX_I_M64 +// CHECK_CORE_AVX_I_M64: #define __AES__ 1 +// FIXME: AVX is not yet enabled with Clang. +// CHECK_CORE_AVX_I_M64-NOT: #define __AVX__ 1 +// CHECK_CORE_AVX_I_M64: #define __MMX__ 1 +// CHECK_CORE_AVX_I_M64: #define __SSE2_MATH__ 1 +// CHECK_CORE_AVX_I_M64: #define __SSE2__ 1 +// CHECK_CORE_AVX_I_M64: #define __SSE3__ 1 +// CHECK_CORE_AVX_I_M64: #define __SSE4_1__ 1 +// CHECK_CORE_AVX_I_M64: #define __SSE4_2__ 1 +// CHECK_CORE_AVX_I_M64: #define __SSE_MATH__ 1 +// CHECK_CORE_AVX_I_M64: #define __SSE__ 1 +// CHECK_CORE_AVX_I_M64: #define __SSSE3__ 1 +// CHECK_CORE_AVX_I_M64: #define __amd64 1 +// CHECK_CORE_AVX_I_M64: #define __amd64__ 1 +// CHECK_CORE_AVX_I_M64: #define __corei7 1 +// CHECK_CORE_AVX_I_M64: #define __corei7__ 1 +// CHECK_CORE_AVX_I_M64: #define __tune_corei7__ 1 +// CHECK_CORE_AVX_I_M64: #define __x86_64 1 +// CHECK_CORE_AVX_I_M64: #define __x86_64__ 1 +// +// RUN: %clang -march=atom -m32 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_ATOM_M32 +// CHECK_ATOM_M32: #define __MMX__ 1 +// CHECK_ATOM_M32: #define __SSE2__ 1 +// CHECK_ATOM_M32: #define __SSE3__ 1 +// CHECK_ATOM_M32: #define __SSE__ 1 +// CHECK_ATOM_M32: #define __SSSE3__ 1 +// CHECK_ATOM_M32: #define __atom 1 +// CHECK_ATOM_M32: #define __atom__ 1 +// CHECK_ATOM_M32: #define __i386 1 +// CHECK_ATOM_M32: #define __i386__ 1 +// CHECK_ATOM_M32: #define __tune_atom__ 1 +// CHECK_ATOM_M32: #define i386 1 +// RUN: %clang -march=atom -m64 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_ATOM_M64 +// CHECK_ATOM_M64: #define __MMX__ 1 +// CHECK_ATOM_M64: #define __SSE2_MATH__ 1 +// CHECK_ATOM_M64: #define __SSE2__ 1 +// CHECK_ATOM_M64: #define __SSE3__ 1 +// CHECK_ATOM_M64: #define __SSE_MATH__ 1 +// CHECK_ATOM_M64: #define __SSE__ 1 +// CHECK_ATOM_M64: #define __SSSE3__ 1 +// CHECK_ATOM_M64: #define __amd64 1 +// CHECK_ATOM_M64: #define __amd64__ 1 +// CHECK_ATOM_M64: #define __atom 1 +// CHECK_ATOM_M64: #define __atom__ 1 +// CHECK_ATOM_M64: #define __tune_atom__ 1 +// CHECK_ATOM_M64: #define __x86_64 1 +// CHECK_ATOM_M64: #define __x86_64__ 1 +// +// RUN: %clang -march=geode -m32 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_GEODE_M32 +// CHECK_GEODE_M32: #define __3dNOW_A__ 1 +// CHECK_GEODE_M32: #define __3dNOW__ 1 +// CHECK_GEODE_M32: #define __MMX__ 1 +// CHECK_GEODE_M32: #define __geode 1 +// CHECK_GEODE_M32: #define __geode__ 1 +// CHECK_GEODE_M32: #define __i386 1 +// CHECK_GEODE_M32: #define __i386__ 1 +// CHECK_GEODE_M32: #define __tune_geode__ 1 +// CHECK_GEODE_M32: #define i386 1 +// RUN: %clang -march=geode -m64 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_GEODE_M64 +// CHECK_GEODE_M64: error: +// +// RUN: %clang -march=k6 -m32 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_K6_M32 +// CHECK_K6_M32: #define __MMX__ 1 +// CHECK_K6_M32: #define __i386 1 +// CHECK_K6_M32: #define __i386__ 1 +// CHECK_K6_M32: #define __k6 1 +// CHECK_K6_M32: #define __k6__ 1 +// CHECK_K6_M32: #define __tune_k6__ 1 +// CHECK_K6_M32: #define i386 1 +// RUN: %clang -march=k6 -m64 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_K6_M64 +// CHECK_K6_M64: error: +// +// RUN: %clang -march=k6-2 -m32 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_K6_2_M32 +// CHECK_K6_2_M32: #define __3dNOW__ 1 +// CHECK_K6_2_M32: #define __MMX__ 1 +// CHECK_K6_2_M32: #define __i386 1 +// CHECK_K6_2_M32: #define __i386__ 1 +// CHECK_K6_2_M32: #define __k6 1 +// CHECK_K6_2_M32: #define __k6_2__ 1 +// CHECK_K6_2_M32: #define __k6__ 1 +// CHECK_K6_2_M32: #define __tune_k6_2__ 1 +// CHECK_K6_2_M32: #define __tune_k6__ 1 +// CHECK_K6_2_M32: #define i386 1 +// RUN: %clang -march=k6-2 -m64 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_K6_2_M64 +// CHECK_K6_2_M64: error: +// +// RUN: %clang -march=k6-3 -m32 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_K6_3_M32 +// CHECK_K6_3_M32: #define __3dNOW__ 1 +// CHECK_K6_3_M32: #define __MMX__ 1 +// CHECK_K6_3_M32: #define __i386 1 +// CHECK_K6_3_M32: #define __i386__ 1 +// CHECK_K6_3_M32: #define __k6 1 +// CHECK_K6_3_M32: #define __k6_3__ 1 +// CHECK_K6_3_M32: #define __k6__ 1 +// CHECK_K6_3_M32: #define __tune_k6_3__ 1 +// CHECK_K6_3_M32: #define __tune_k6__ 1 +// CHECK_K6_3_M32: #define i386 1 +// RUN: %clang -march=k6-3 -m64 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_K6_3_M64 +// CHECK_K6_3_M64: error: +// +// RUN: %clang -march=athlon -m32 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_ATHLON_M32 +// CHECK_ATHLON_M32: #define __3dNOW_A__ 1 +// CHECK_ATHLON_M32: #define __3dNOW__ 1 +// CHECK_ATHLON_M32: #define __MMX__ 1 +// CHECK_ATHLON_M32: #define __athlon 1 +// CHECK_ATHLON_M32: #define __athlon__ 1 +// CHECK_ATHLON_M32: #define __i386 1 +// CHECK_ATHLON_M32: #define __i386__ 1 +// CHECK_ATHLON_M32: #define __tune_athlon__ 1 +// CHECK_ATHLON_M32: #define i386 1 +// RUN: %clang -march=athlon -m64 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_ATHLON_M64 +// CHECK_ATHLON_M64: error: +// +// RUN: %clang -march=athlon-tbird -m32 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_ATHLON_TBIRD_M32 +// CHECK_ATHLON_TBIRD_M32: #define __3dNOW_A__ 1 +// CHECK_ATHLON_TBIRD_M32: #define __3dNOW__ 1 +// CHECK_ATHLON_TBIRD_M32: #define __MMX__ 1 +// CHECK_ATHLON_TBIRD_M32: #define __athlon 1 +// CHECK_ATHLON_TBIRD_M32: #define __athlon__ 1 +// CHECK_ATHLON_TBIRD_M32: #define __i386 1 +// CHECK_ATHLON_TBIRD_M32: #define __i386__ 1 +// CHECK_ATHLON_TBIRD_M32: #define __tune_athlon__ 1 +// CHECK_ATHLON_TBIRD_M32: #define i386 1 +// RUN: %clang -march=athlon-tbird -m64 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_ATHLON_TBIRD_M64 +// CHECK_ATHLON_TBIRD_M64: error: +// +// RUN: %clang -march=athlon-4 -m32 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_ATHLON_4_M32 +// CHECK_ATHLON_4_M32: #define __3dNOW_A__ 1 +// CHECK_ATHLON_4_M32: #define __3dNOW__ 1 +// CHECK_ATHLON_4_M32: #define __MMX__ 1 +// CHECK_ATHLON_4_M32: #define __SSE__ 1 +// CHECK_ATHLON_4_M32: #define __athlon 1 +// CHECK_ATHLON_4_M32: #define __athlon__ 1 +// CHECK_ATHLON_4_M32: #define __athlon_sse__ 1 +// CHECK_ATHLON_4_M32: #define __i386 1 +// CHECK_ATHLON_4_M32: #define __i386__ 1 +// CHECK_ATHLON_4_M32: #define __tune_athlon__ 1 +// CHECK_ATHLON_4_M32: #define __tune_athlon_sse__ 1 +// CHECK_ATHLON_4_M32: #define i386 1 +// RUN: %clang -march=athlon-4 -m64 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_ATHLON_4_M64 +// CHECK_ATHLON_4_M64: error: +// +// RUN: %clang -march=athlon-xp -m32 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_ATHLON_XP_M32 +// CHECK_ATHLON_XP_M32: #define __3dNOW_A__ 1 +// CHECK_ATHLON_XP_M32: #define __3dNOW__ 1 +// CHECK_ATHLON_XP_M32: #define __MMX__ 1 +// CHECK_ATHLON_XP_M32: #define __SSE__ 1 +// CHECK_ATHLON_XP_M32: #define __athlon 1 +// CHECK_ATHLON_XP_M32: #define __athlon__ 1 +// CHECK_ATHLON_XP_M32: #define __athlon_sse__ 1 +// CHECK_ATHLON_XP_M32: #define __i386 1 +// CHECK_ATHLON_XP_M32: #define __i386__ 1 +// CHECK_ATHLON_XP_M32: #define __tune_athlon__ 1 +// CHECK_ATHLON_XP_M32: #define __tune_athlon_sse__ 1 +// CHECK_ATHLON_XP_M32: #define i386 1 +// RUN: %clang -march=athlon-xp -m64 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_ATHLON_XP_M64 +// CHECK_ATHLON_XP_M64: error: +// +// RUN: %clang -march=athlon-mp -m32 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_ATHLON_MP_M32 +// CHECK_ATHLON_MP_M32: #define __3dNOW_A__ 1 +// CHECK_ATHLON_MP_M32: #define __3dNOW__ 1 +// CHECK_ATHLON_MP_M32: #define __MMX__ 1 +// CHECK_ATHLON_MP_M32: #define __SSE__ 1 +// CHECK_ATHLON_MP_M32: #define __athlon 1 +// CHECK_ATHLON_MP_M32: #define __athlon__ 1 +// CHECK_ATHLON_MP_M32: #define __athlon_sse__ 1 +// CHECK_ATHLON_MP_M32: #define __i386 1 +// CHECK_ATHLON_MP_M32: #define __i386__ 1 +// CHECK_ATHLON_MP_M32: #define __tune_athlon__ 1 +// CHECK_ATHLON_MP_M32: #define __tune_athlon_sse__ 1 +// CHECK_ATHLON_MP_M32: #define i386 1 +// RUN: %clang -march=athlon-mp -m64 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_ATHLON_MP_M64 +// CHECK_ATHLON_MP_M64: error: +// +// RUN: %clang -march=x86-64 -m32 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_X86_64_M32 +// CHECK_X86_64_M32: #define __MMX__ 1 +// CHECK_X86_64_M32: #define __SSE2__ 1 +// CHECK_X86_64_M32: #define __SSE__ 1 +// CHECK_X86_64_M32: #define __i386 1 +// CHECK_X86_64_M32: #define __i386__ 1 +// CHECK_X86_64_M32: #define __k8 1 +// CHECK_X86_64_M32: #define __k8__ 1 +// CHECK_X86_64_M32: #define i386 1 +// RUN: %clang -march=x86-64 -m64 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_X86_64_M64 +// CHECK_X86_64_M64: #define __MMX__ 1 +// CHECK_X86_64_M64: #define __SSE2_MATH__ 1 +// CHECK_X86_64_M64: #define __SSE2__ 1 +// CHECK_X86_64_M64: #define __SSE_MATH__ 1 +// CHECK_X86_64_M64: #define __SSE__ 1 +// CHECK_X86_64_M64: #define __amd64 1 +// CHECK_X86_64_M64: #define __amd64__ 1 +// CHECK_X86_64_M64: #define __k8 1 +// CHECK_X86_64_M64: #define __k8__ 1 +// CHECK_X86_64_M64: #define __x86_64 1 +// CHECK_X86_64_M64: #define __x86_64__ 1 +// +// RUN: %clang -march=k8 -m32 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_K8_M32 +// CHECK_K8_M32: #define __3dNOW_A__ 1 +// CHECK_K8_M32: #define __3dNOW__ 1 +// CHECK_K8_M32: #define __MMX__ 1 +// CHECK_K8_M32: #define __SSE2__ 1 +// CHECK_K8_M32: #define __SSE__ 1 +// CHECK_K8_M32: #define __i386 1 +// CHECK_K8_M32: #define __i386__ 1 +// CHECK_K8_M32: #define __k8 1 +// CHECK_K8_M32: #define __k8__ 1 +// CHECK_K8_M32: #define __tune_k8__ 1 +// CHECK_K8_M32: #define i386 1 +// RUN: %clang -march=k8 -m64 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_K8_M64 +// CHECK_K8_M64: #define __3dNOW_A__ 1 +// CHECK_K8_M64: #define __3dNOW__ 1 +// CHECK_K8_M64: #define __MMX__ 1 +// CHECK_K8_M64: #define __SSE2_MATH__ 1 +// CHECK_K8_M64: #define __SSE2__ 1 +// CHECK_K8_M64: #define __SSE_MATH__ 1 +// CHECK_K8_M64: #define __SSE__ 1 +// CHECK_K8_M64: #define __amd64 1 +// CHECK_K8_M64: #define __amd64__ 1 +// CHECK_K8_M64: #define __k8 1 +// CHECK_K8_M64: #define __k8__ 1 +// CHECK_K8_M64: #define __tune_k8__ 1 +// CHECK_K8_M64: #define __x86_64 1 +// CHECK_K8_M64: #define __x86_64__ 1 +// +// RUN: %clang -march=k8-sse3 -m32 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_K8_SSE3_M32 +// CHECK_K8_SSE3_M32: #define __3dNOW_A__ 1 +// CHECK_K8_SSE3_M32: #define __3dNOW__ 1 +// CHECK_K8_SSE3_M32: #define __MMX__ 1 +// CHECK_K8_SSE3_M32: #define __SSE2__ 1 +// CHECK_K8_SSE3_M32: #define __SSE3__ 1 +// CHECK_K8_SSE3_M32: #define __SSE__ 1 +// CHECK_K8_SSE3_M32: #define __i386 1 +// CHECK_K8_SSE3_M32: #define __i386__ 1 +// CHECK_K8_SSE3_M32: #define __k8 1 +// CHECK_K8_SSE3_M32: #define __k8__ 1 +// CHECK_K8_SSE3_M32: #define __tune_k8__ 1 +// CHECK_K8_SSE3_M32: #define i386 1 +// RUN: %clang -march=k8-sse3 -m64 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_K8_SSE3_M64 +// CHECK_K8_SSE3_M64: #define __3dNOW_A__ 1 +// CHECK_K8_SSE3_M64: #define __3dNOW__ 1 +// CHECK_K8_SSE3_M64: #define __MMX__ 1 +// CHECK_K8_SSE3_M64: #define __SSE2_MATH__ 1 +// CHECK_K8_SSE3_M64: #define __SSE2__ 1 +// CHECK_K8_SSE3_M64: #define __SSE3__ 1 +// CHECK_K8_SSE3_M64: #define __SSE_MATH__ 1 +// CHECK_K8_SSE3_M64: #define __SSE__ 1 +// CHECK_K8_SSE3_M64: #define __amd64 1 +// CHECK_K8_SSE3_M64: #define __amd64__ 1 +// CHECK_K8_SSE3_M64: #define __k8 1 +// CHECK_K8_SSE3_M64: #define __k8__ 1 +// CHECK_K8_SSE3_M64: #define __tune_k8__ 1 +// CHECK_K8_SSE3_M64: #define __x86_64 1 +// CHECK_K8_SSE3_M64: #define __x86_64__ 1 +// +// RUN: %clang -march=opteron -m32 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_OPTERON_M32 +// CHECK_OPTERON_M32: #define __3dNOW_A__ 1 +// CHECK_OPTERON_M32: #define __3dNOW__ 1 +// CHECK_OPTERON_M32: #define __MMX__ 1 +// CHECK_OPTERON_M32: #define __SSE2__ 1 +// CHECK_OPTERON_M32: #define __SSE__ 1 +// CHECK_OPTERON_M32: #define __i386 1 +// CHECK_OPTERON_M32: #define __i386__ 1 +// CHECK_OPTERON_M32: #define __k8 1 +// CHECK_OPTERON_M32: #define __k8__ 1 +// CHECK_OPTERON_M32: #define __tune_k8__ 1 +// CHECK_OPTERON_M32: #define i386 1 +// RUN: %clang -march=opteron -m64 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_OPTERON_M64 +// CHECK_OPTERON_M64: #define __3dNOW_A__ 1 +// CHECK_OPTERON_M64: #define __3dNOW__ 1 +// CHECK_OPTERON_M64: #define __MMX__ 1 +// CHECK_OPTERON_M64: #define __SSE2_MATH__ 1 +// CHECK_OPTERON_M64: #define __SSE2__ 1 +// CHECK_OPTERON_M64: #define __SSE_MATH__ 1 +// CHECK_OPTERON_M64: #define __SSE__ 1 +// CHECK_OPTERON_M64: #define __amd64 1 +// CHECK_OPTERON_M64: #define __amd64__ 1 +// CHECK_OPTERON_M64: #define __k8 1 +// CHECK_OPTERON_M64: #define __k8__ 1 +// CHECK_OPTERON_M64: #define __tune_k8__ 1 +// CHECK_OPTERON_M64: #define __x86_64 1 +// CHECK_OPTERON_M64: #define __x86_64__ 1 +// +// RUN: %clang -march=opteron-sse3 -m32 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_OPTERON_SSE3_M32 +// CHECK_OPTERON_SSE3_M32: #define __3dNOW_A__ 1 +// CHECK_OPTERON_SSE3_M32: #define __3dNOW__ 1 +// CHECK_OPTERON_SSE3_M32: #define __MMX__ 1 +// CHECK_OPTERON_SSE3_M32: #define __SSE2__ 1 +// CHECK_OPTERON_SSE3_M32: #define __SSE3__ 1 +// CHECK_OPTERON_SSE3_M32: #define __SSE__ 1 +// CHECK_OPTERON_SSE3_M32: #define __i386 1 +// CHECK_OPTERON_SSE3_M32: #define __i386__ 1 +// CHECK_OPTERON_SSE3_M32: #define __k8 1 +// CHECK_OPTERON_SSE3_M32: #define __k8__ 1 +// CHECK_OPTERON_SSE3_M32: #define __tune_k8__ 1 +// CHECK_OPTERON_SSE3_M32: #define i386 1 +// RUN: %clang -march=opteron-sse3 -m64 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_OPTERON_SSE3_M64 +// CHECK_OPTERON_SSE3_M64: #define __3dNOW_A__ 1 +// CHECK_OPTERON_SSE3_M64: #define __3dNOW__ 1 +// CHECK_OPTERON_SSE3_M64: #define __MMX__ 1 +// CHECK_OPTERON_SSE3_M64: #define __SSE2_MATH__ 1 +// CHECK_OPTERON_SSE3_M64: #define __SSE2__ 1 +// CHECK_OPTERON_SSE3_M64: #define __SSE3__ 1 +// CHECK_OPTERON_SSE3_M64: #define __SSE_MATH__ 1 +// CHECK_OPTERON_SSE3_M64: #define __SSE__ 1 +// CHECK_OPTERON_SSE3_M64: #define __amd64 1 +// CHECK_OPTERON_SSE3_M64: #define __amd64__ 1 +// CHECK_OPTERON_SSE3_M64: #define __k8 1 +// CHECK_OPTERON_SSE3_M64: #define __k8__ 1 +// CHECK_OPTERON_SSE3_M64: #define __tune_k8__ 1 +// CHECK_OPTERON_SSE3_M64: #define __x86_64 1 +// CHECK_OPTERON_SSE3_M64: #define __x86_64__ 1 +// +// RUN: %clang -march=athlon64 -m32 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_ATHLON64_M32 +// CHECK_ATHLON64_M32: #define __3dNOW_A__ 1 +// CHECK_ATHLON64_M32: #define __3dNOW__ 1 +// CHECK_ATHLON64_M32: #define __MMX__ 1 +// CHECK_ATHLON64_M32: #define __SSE2__ 1 +// CHECK_ATHLON64_M32: #define __SSE__ 1 +// CHECK_ATHLON64_M32: #define __i386 1 +// CHECK_ATHLON64_M32: #define __i386__ 1 +// CHECK_ATHLON64_M32: #define __k8 1 +// CHECK_ATHLON64_M32: #define __k8__ 1 +// CHECK_ATHLON64_M32: #define __tune_k8__ 1 +// CHECK_ATHLON64_M32: #define i386 1 +// RUN: %clang -march=athlon64 -m64 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_ATHLON64_M64 +// CHECK_ATHLON64_M64: #define __3dNOW_A__ 1 +// CHECK_ATHLON64_M64: #define __3dNOW__ 1 +// CHECK_ATHLON64_M64: #define __MMX__ 1 +// CHECK_ATHLON64_M64: #define __SSE2_MATH__ 1 +// CHECK_ATHLON64_M64: #define __SSE2__ 1 +// CHECK_ATHLON64_M64: #define __SSE_MATH__ 1 +// CHECK_ATHLON64_M64: #define __SSE__ 1 +// CHECK_ATHLON64_M64: #define __amd64 1 +// CHECK_ATHLON64_M64: #define __amd64__ 1 +// CHECK_ATHLON64_M64: #define __k8 1 +// CHECK_ATHLON64_M64: #define __k8__ 1 +// CHECK_ATHLON64_M64: #define __tune_k8__ 1 +// CHECK_ATHLON64_M64: #define __x86_64 1 +// CHECK_ATHLON64_M64: #define __x86_64__ 1 +// +// RUN: %clang -march=athlon64-sse3 -m32 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_ATHLON64_SSE3_M32 +// CHECK_ATHLON64_SSE3_M32: #define __3dNOW_A__ 1 +// CHECK_ATHLON64_SSE3_M32: #define __3dNOW__ 1 +// CHECK_ATHLON64_SSE3_M32: #define __MMX__ 1 +// CHECK_ATHLON64_SSE3_M32: #define __SSE2__ 1 +// CHECK_ATHLON64_SSE3_M32: #define __SSE3__ 1 +// CHECK_ATHLON64_SSE3_M32: #define __SSE__ 1 +// CHECK_ATHLON64_SSE3_M32: #define __i386 1 +// CHECK_ATHLON64_SSE3_M32: #define __i386__ 1 +// CHECK_ATHLON64_SSE3_M32: #define __k8 1 +// CHECK_ATHLON64_SSE3_M32: #define __k8__ 1 +// CHECK_ATHLON64_SSE3_M32: #define __tune_k8__ 1 +// CHECK_ATHLON64_SSE3_M32: #define i386 1 +// RUN: %clang -march=athlon64-sse3 -m64 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_ATHLON64_SSE3_M64 +// CHECK_ATHLON64_SSE3_M64: #define __3dNOW_A__ 1 +// CHECK_ATHLON64_SSE3_M64: #define __3dNOW__ 1 +// CHECK_ATHLON64_SSE3_M64: #define __MMX__ 1 +// CHECK_ATHLON64_SSE3_M64: #define __SSE2_MATH__ 1 +// CHECK_ATHLON64_SSE3_M64: #define __SSE2__ 1 +// CHECK_ATHLON64_SSE3_M64: #define __SSE3__ 1 +// CHECK_ATHLON64_SSE3_M64: #define __SSE_MATH__ 1 +// CHECK_ATHLON64_SSE3_M64: #define __SSE__ 1 +// CHECK_ATHLON64_SSE3_M64: #define __amd64 1 +// CHECK_ATHLON64_SSE3_M64: #define __amd64__ 1 +// CHECK_ATHLON64_SSE3_M64: #define __k8 1 +// CHECK_ATHLON64_SSE3_M64: #define __k8__ 1 +// CHECK_ATHLON64_SSE3_M64: #define __tune_k8__ 1 +// CHECK_ATHLON64_SSE3_M64: #define __x86_64 1 +// CHECK_ATHLON64_SSE3_M64: #define __x86_64__ 1 +// +// RUN: %clang -march=athlon-fx -m32 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_ATHLON_FX_M32 +// CHECK_ATHLON_FX_M32: #define __3dNOW_A__ 1 +// CHECK_ATHLON_FX_M32: #define __3dNOW__ 1 +// CHECK_ATHLON_FX_M32: #define __MMX__ 1 +// CHECK_ATHLON_FX_M32: #define __SSE2__ 1 +// CHECK_ATHLON_FX_M32: #define __SSE__ 1 +// CHECK_ATHLON_FX_M32: #define __i386 1 +// CHECK_ATHLON_FX_M32: #define __i386__ 1 +// CHECK_ATHLON_FX_M32: #define __k8 1 +// CHECK_ATHLON_FX_M32: #define __k8__ 1 +// CHECK_ATHLON_FX_M32: #define __tune_k8__ 1 +// CHECK_ATHLON_FX_M32: #define i386 1 +// RUN: %clang -march=athlon-fx -m64 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_ATHLON_FX_M64 +// CHECK_ATHLON_FX_M64: #define __3dNOW_A__ 1 +// CHECK_ATHLON_FX_M64: #define __3dNOW__ 1 +// CHECK_ATHLON_FX_M64: #define __MMX__ 1 +// CHECK_ATHLON_FX_M64: #define __SSE2_MATH__ 1 +// CHECK_ATHLON_FX_M64: #define __SSE2__ 1 +// CHECK_ATHLON_FX_M64: #define __SSE_MATH__ 1 +// CHECK_ATHLON_FX_M64: #define __SSE__ 1 +// CHECK_ATHLON_FX_M64: #define __amd64 1 +// CHECK_ATHLON_FX_M64: #define __amd64__ 1 +// CHECK_ATHLON_FX_M64: #define __k8 1 +// CHECK_ATHLON_FX_M64: #define __k8__ 1 +// CHECK_ATHLON_FX_M64: #define __tune_k8__ 1 +// CHECK_ATHLON_FX_M64: #define __x86_64 1 +// CHECK_ATHLON_FX_M64: #define __x86_64__ 1 +// +// End X86/GCC/Linux tests ------------------ diff --git a/clang/test/Preprocessor/predefined-exceptions.m b/clang/test/Preprocessor/predefined-exceptions.m new file mode 100644 index 0000000..c13f429 --- /dev/null +++ b/clang/test/Preprocessor/predefined-exceptions.m @@ -0,0 +1,15 @@ +// RUN: %clang_cc1 -x objective-c -fobjc-exceptions -fexceptions -E -dM %s | FileCheck -check-prefix=CHECK-OBJC-NOCXX %s +// CHECK-OBJC-NOCXX: #define OBJC_ZEROCOST_EXCEPTIONS 1 +// CHECK-OBJC-NOCXX-NOT: #define __EXCEPTIONS 1 + +// RUN: %clang_cc1 -x objective-c++ -fobjc-exceptions -fexceptions -fcxx-exceptions -E -dM %s | FileCheck -check-prefix=CHECK-OBJC-CXX %s +// CHECK-OBJC-CXX: #define OBJC_ZEROCOST_EXCEPTIONS 1 +// CHECK-OBJC-CXX: #define __EXCEPTIONS 1 + +// RUN: %clang_cc1 -x objective-c++ -fexceptions -fcxx-exceptions -E -dM %s | FileCheck -check-prefix=CHECK-NOOBJC-CXX %s +// CHECK-NOOBJC-CXX-NOT: #define OBJC_ZEROCOST_EXCEPTIONS 1 +// CHECK-NOOBJC-CXX: #define __EXCEPTIONS 1 + +// RUN: %clang_cc1 -x objective-c -E -dM %s | FileCheck -check-prefix=CHECK-NOOBJC-NOCXX %s +// CHECK-NOOBJC-NOCXX-NOT: #define OBJC_ZEROCOST_EXCEPTIONS 1 +// CHECK-NOOBJC-NOCXX-NOT: #define __EXCEPTIONS 1 diff --git a/clang/test/Preprocessor/predefined-macros.c b/clang/test/Preprocessor/predefined-macros.c new file mode 100644 index 0000000..5c11c3b --- /dev/null +++ b/clang/test/Preprocessor/predefined-macros.c @@ -0,0 +1,15 @@ +// This test verifies that the correct macros are predefined. +// +// RUN: %clang_cc1 %s -E -dM -triple i686-pc-win32 -fms-extensions -fms-compatibility \ +// RUN: -fmsc-version=1300 -o - | FileCheck %s --check-prefix=CHECK-MS +// CHECK-MS: #define _INTEGRAL_MAX_BITS 64 +// CHECK-MS: #define _MSC_EXTENSIONS 1 +// CHECK-MS: #define _MSC_VER 1300 +// CHECK-MS: #define _M_IX86 600 +// CHECK-MS: #define _M_IX86_FP +// CHECK-MS: #define _WIN32 1 +// CHECK-MS-NOT: #define __GNUC__ +// +// RUN: %clang_cc1 %s -E -dM -ffast-math -o - \ +// RUN: | FileCheck %s --check-prefix=CHECK-FAST-MATH +// CHECK-FAST-MATH: #define __FAST_MATH__ diff --git a/clang/test/Preprocessor/print_line_count.c b/clang/test/Preprocessor/print_line_count.c new file mode 100644 index 0000000..6a02b0e --- /dev/null +++ b/clang/test/Preprocessor/print_line_count.c @@ -0,0 +1,4 @@ +/* RUN: %clang -E -C -P %s | wc -l | grep 4 + PR2741 + comment */ +y diff --git a/clang/test/Preprocessor/print_line_empty_file.c b/clang/test/Preprocessor/print_line_empty_file.c new file mode 100644 index 0000000..868d0b7 --- /dev/null +++ b/clang/test/Preprocessor/print_line_empty_file.c @@ -0,0 +1,12 @@ +// RUN: %clang_cc1 -E %s | FileCheck %s + +#line 21 "" +int foo() { return 42; } + +#line 4 "bug.c" +int bar() { return 21; } + +// CHECK: # 21 "" +// CHECK: int foo() { return 42; } +// CHECK: # 4 "bug.c" +// CHECK: int bar() { return 21; } diff --git a/clang/test/Preprocessor/print_line_track.c b/clang/test/Preprocessor/print_line_track.c new file mode 100644 index 0000000..fb2ccf2 --- /dev/null +++ b/clang/test/Preprocessor/print_line_track.c @@ -0,0 +1,17 @@ +/* RUN: %clang_cc1 -E %s | grep 'a 3' + * RUN: %clang_cc1 -E %s | grep 'b 16' + * RUN: %clang_cc1 -E -P %s | grep 'a 3' + * RUN: %clang_cc1 -E -P %s | grep 'b 16' + * RUN: %clang_cc1 -E %s | not grep '# 0 ' + * RUN: %clang_cc1 -E -P %s | count 4 + * PR1848 PR3437 PR7360 +*/ + +#define t(x) x + +t(a +3) + +t(b +__LINE__) + diff --git a/clang/test/Preprocessor/pushable-diagnostics.c b/clang/test/Preprocessor/pushable-diagnostics.c new file mode 100644 index 0000000..877eaaa --- /dev/null +++ b/clang/test/Preprocessor/pushable-diagnostics.c @@ -0,0 +1,17 @@ +// RUN: %clang_cc1 -fsyntax-only -verify -pedantic %s + +#pragma clang diagnostic pop // expected-warning{{pragma diagnostic pop could not pop, no matching push}} + +#pragma clang diagnostic puhs // expected-warning {{pragma diagnostic expected 'error', 'warning', 'ignored', 'fatal', 'push', or 'pop'}} + +int a = 'df'; // expected-warning{{multi-character character constant}} + +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wmultichar" + +int b = 'df'; // no warning. +#pragma clang diagnostic pop + +int c = 'df'; // expected-warning{{multi-character character constant}} + +#pragma clang diagnostic pop // expected-warning{{pragma diagnostic pop could not pop, no matching push}} diff --git a/clang/test/Preprocessor/skipping_unclean.c b/clang/test/Preprocessor/skipping_unclean.c new file mode 100644 index 0000000..52d1785 --- /dev/null +++ b/clang/test/Preprocessor/skipping_unclean.c @@ -0,0 +1,9 @@ +// RUN: %clang_cc1 -E %s | grep bark + +#if 0 +blah +#\ +else +bark +#endif + diff --git a/clang/test/Preprocessor/stdint.c b/clang/test/Preprocessor/stdint.c new file mode 100644 index 0000000..70c106b --- /dev/null +++ b/clang/test/Preprocessor/stdint.c @@ -0,0 +1,959 @@ +// RUN: %clang_cc1 -E -ffreestanding -triple=arm-none-none %s | FileCheck -check-prefix ARM %s +// +// ARM:typedef signed long long int int64_t; +// ARM:typedef unsigned long long int uint64_t; +// ARM:typedef int64_t int_least64_t; +// ARM:typedef uint64_t uint_least64_t; +// ARM:typedef int64_t int_fast64_t; +// ARM:typedef uint64_t uint_fast64_t; +// +// ARM:typedef signed int int32_t; +// ARM:typedef unsigned int uint32_t; +// ARM:typedef int32_t int_least32_t; +// ARM:typedef uint32_t uint_least32_t; +// ARM:typedef int32_t int_fast32_t; +// ARM:typedef uint32_t uint_fast32_t; +// +// ARM:typedef signed short int16_t; +// ARM:typedef unsigned short uint16_t; +// ARM:typedef int16_t int_least16_t; +// ARM:typedef uint16_t uint_least16_t; +// ARM:typedef int16_t int_fast16_t; +// ARM:typedef uint16_t uint_fast16_t; +// +// ARM:typedef signed char int8_t; +// ARM:typedef unsigned char uint8_t; +// ARM:typedef int8_t int_least8_t; +// ARM:typedef uint8_t uint_least8_t; +// ARM:typedef int8_t int_fast8_t; +// ARM:typedef uint8_t uint_fast8_t; +// +// ARM:typedef int32_t intptr_t; +// ARM:typedef uint32_t uintptr_t; +// +// ARM:typedef long long int intmax_t; +// ARM:typedef long long unsigned int uintmax_t; +// +// ARM:INT8_MAX_ 127 +// ARM:INT8_MIN_ (-127 -1) +// ARM:UINT8_MAX_ 255 +// ARM:INT_LEAST8_MIN_ (-127 -1) +// ARM:INT_LEAST8_MAX_ 127 +// ARM:UINT_LEAST8_MAX_ 255 +// ARM:INT_FAST8_MIN_ (-127 -1) +// ARM:INT_FAST8_MAX_ 127 +// ARM:UINT_FAST8_MAX_ 255 +// +// ARM:INT16_MAX_ 32767 +// ARM:INT16_MIN_ (-32767 -1) +// ARM:UINT16_MAX_ 65535 +// ARM:INT_LEAST16_MIN_ (-32767 -1) +// ARM:INT_LEAST16_MAX_ 32767 +// ARM:UINT_LEAST16_MAX_ 65535 +// ARM:INT_FAST16_MIN_ (-32767 -1) +// ARM:INT_FAST16_MAX_ 32767 +// ARM:UINT_FAST16_MAX_ 65535 +// +// ARM:INT32_MAX_ 2147483647 +// ARM:INT32_MIN_ (-2147483647 -1) +// ARM:UINT32_MAX_ 4294967295U +// ARM:INT_LEAST32_MIN_ (-2147483647 -1) +// ARM:INT_LEAST32_MAX_ 2147483647 +// ARM:UINT_LEAST32_MAX_ 4294967295U +// ARM:INT_FAST32_MIN_ (-2147483647 -1) +// ARM:INT_FAST32_MAX_ 2147483647 +// ARM:UINT_FAST32_MAX_ 4294967295U +// +// ARM:INT64_MAX_ 9223372036854775807LL +// ARM:INT64_MIN_ (-9223372036854775807LL -1) +// ARM:UINT64_MAX_ 18446744073709551615ULL +// ARM:INT_LEAST64_MIN_ (-9223372036854775807LL -1) +// ARM:INT_LEAST64_MAX_ 9223372036854775807LL +// ARM:UINT_LEAST64_MAX_ 18446744073709551615ULL +// ARM:INT_FAST64_MIN_ (-9223372036854775807LL -1) +// ARM:INT_FAST64_MAX_ 9223372036854775807LL +// ARM:UINT_FAST64_MAX_ 18446744073709551615ULL +// +// ARM:INTPTR_MIN_ (-2147483647 -1) +// ARM:INTPTR_MAX_ 2147483647 +// ARM:UINTPTR_MAX_ 4294967295U +// ARM:PTRDIFF_MIN_ (-2147483647 -1) +// ARM:PTRDIFF_MAX_ 2147483647 +// ARM:SIZE_MAX_ 4294967295U +// +// ARM:INTMAX_MIN_ (-9223372036854775807LL -1) +// ARM:INTMAX_MAX_ 9223372036854775807LL +// ARM:UINTMAX_MAX_ 18446744073709551615ULL +// +// ARM:SIG_ATOMIC_MIN_ (-2147483647 -1) +// ARM:SIG_ATOMIC_MAX_ 2147483647 +// ARM:WINT_MIN_ (-2147483647 -1) +// ARM:WINT_MAX_ 2147483647 +// +// ARM:WCHAR_MAX_ 4294967295U +// ARM:WCHAR_MIN_ 0U +// +// ARM:INT8_C_(0) 0 +// ARM:UINT8_C_(0) 0U +// ARM:INT16_C_(0) 0 +// ARM:UINT16_C_(0) 0U +// ARM:INT32_C_(0) 0 +// ARM:UINT32_C_(0) 0U +// ARM:INT64_C_(0) 0LL +// ARM:UINT64_C_(0) 0ULL +// +// ARM:INTMAX_C_(0) 0LL +// ARM:UINTMAX_C_(0) 0ULL +// +// +// RUN: %clang_cc1 -E -ffreestanding -triple=i386-none-none %s | FileCheck -check-prefix I386 %s +// +// I386:typedef signed long long int int64_t; +// I386:typedef unsigned long long int uint64_t; +// I386:typedef int64_t int_least64_t; +// I386:typedef uint64_t uint_least64_t; +// I386:typedef int64_t int_fast64_t; +// I386:typedef uint64_t uint_fast64_t; +// +// I386:typedef signed int int32_t; +// I386:typedef unsigned int uint32_t; +// I386:typedef int32_t int_least32_t; +// I386:typedef uint32_t uint_least32_t; +// I386:typedef int32_t int_fast32_t; +// I386:typedef uint32_t uint_fast32_t; +// +// I386:typedef signed short int16_t; +// I386:typedef unsigned short uint16_t; +// I386:typedef int16_t int_least16_t; +// I386:typedef uint16_t uint_least16_t; +// I386:typedef int16_t int_fast16_t; +// I386:typedef uint16_t uint_fast16_t; +// +// I386:typedef signed char int8_t; +// I386:typedef unsigned char uint8_t; +// I386:typedef int8_t int_least8_t; +// I386:typedef uint8_t uint_least8_t; +// I386:typedef int8_t int_fast8_t; +// I386:typedef uint8_t uint_fast8_t; +// +// I386:typedef int32_t intptr_t; +// I386:typedef uint32_t uintptr_t; +// +// I386:typedef long long int intmax_t; +// I386:typedef long long unsigned int uintmax_t; +// +// I386:INT8_MAX_ 127 +// I386:INT8_MIN_ (-127 -1) +// I386:UINT8_MAX_ 255 +// I386:INT_LEAST8_MIN_ (-127 -1) +// I386:INT_LEAST8_MAX_ 127 +// I386:UINT_LEAST8_MAX_ 255 +// I386:INT_FAST8_MIN_ (-127 -1) +// I386:INT_FAST8_MAX_ 127 +// I386:UINT_FAST8_MAX_ 255 +// +// I386:INT16_MAX_ 32767 +// I386:INT16_MIN_ (-32767 -1) +// I386:UINT16_MAX_ 65535 +// I386:INT_LEAST16_MIN_ (-32767 -1) +// I386:INT_LEAST16_MAX_ 32767 +// I386:UINT_LEAST16_MAX_ 65535 +// I386:INT_FAST16_MIN_ (-32767 -1) +// I386:INT_FAST16_MAX_ 32767 +// I386:UINT_FAST16_MAX_ 65535 +// +// I386:INT32_MAX_ 2147483647 +// I386:INT32_MIN_ (-2147483647 -1) +// I386:UINT32_MAX_ 4294967295U +// I386:INT_LEAST32_MIN_ (-2147483647 -1) +// I386:INT_LEAST32_MAX_ 2147483647 +// I386:UINT_LEAST32_MAX_ 4294967295U +// I386:INT_FAST32_MIN_ (-2147483647 -1) +// I386:INT_FAST32_MAX_ 2147483647 +// I386:UINT_FAST32_MAX_ 4294967295U +// +// I386:INT64_MAX_ 9223372036854775807LL +// I386:INT64_MIN_ (-9223372036854775807LL -1) +// I386:UINT64_MAX_ 18446744073709551615ULL +// I386:INT_LEAST64_MIN_ (-9223372036854775807LL -1) +// I386:INT_LEAST64_MAX_ 9223372036854775807LL +// I386:UINT_LEAST64_MAX_ 18446744073709551615ULL +// I386:INT_FAST64_MIN_ (-9223372036854775807LL -1) +// I386:INT_FAST64_MAX_ 9223372036854775807LL +// I386:UINT_FAST64_MAX_ 18446744073709551615ULL +// +// I386:INTPTR_MIN_ (-2147483647 -1) +// I386:INTPTR_MAX_ 2147483647 +// I386:UINTPTR_MAX_ 4294967295U +// I386:PTRDIFF_MIN_ (-2147483647 -1) +// I386:PTRDIFF_MAX_ 2147483647 +// I386:SIZE_MAX_ 4294967295U +// +// I386:INTMAX_MIN_ (-9223372036854775807LL -1) +// I386:INTMAX_MAX_ 9223372036854775807LL +// I386:UINTMAX_MAX_ 18446744073709551615ULL +// +// I386:SIG_ATOMIC_MIN_ (-2147483647 -1) +// I386:SIG_ATOMIC_MAX_ 2147483647 +// I386:WINT_MIN_ (-2147483647 -1) +// I386:WINT_MAX_ 2147483647 +// +// I386:WCHAR_MAX_ 2147483647 +// I386:WCHAR_MIN_ (-2147483647 -1) +// +// I386:INT8_C_(0) 0 +// I386:UINT8_C_(0) 0U +// I386:INT16_C_(0) 0 +// I386:UINT16_C_(0) 0U +// I386:INT32_C_(0) 0 +// I386:UINT32_C_(0) 0U +// I386:INT64_C_(0) 0LL +// I386:UINT64_C_(0) 0ULL +// +// I386:INTMAX_C_(0) 0LL +// I386:UINTMAX_C_(0) 0ULL +// +// RUN: %clang_cc1 -E -ffreestanding -triple=msp430-none-none %s | FileCheck -check-prefix MSP430 %s +// +// MSP430:typedef signed long int int32_t; +// MSP430:typedef unsigned long int uint32_t; +// MSP430:typedef int32_t int_least32_t; +// MSP430:typedef uint32_t uint_least32_t; +// MSP430:typedef int32_t int_fast32_t; +// MSP430:typedef uint32_t uint_fast32_t; +// +// MSP430:typedef signed short int16_t; +// MSP430:typedef unsigned short uint16_t; +// MSP430:typedef int16_t int_least16_t; +// MSP430:typedef uint16_t uint_least16_t; +// MSP430:typedef int16_t int_fast16_t; +// MSP430:typedef uint16_t uint_fast16_t; +// +// MSP430:typedef signed char int8_t; +// MSP430:typedef unsigned char uint8_t; +// MSP430:typedef int8_t int_least8_t; +// MSP430:typedef uint8_t uint_least8_t; +// MSP430:typedef int8_t int_fast8_t; +// MSP430:typedef uint8_t uint_fast8_t; +// +// MSP430:typedef int16_t intptr_t; +// MSP430:typedef uint16_t uintptr_t; +// +// MSP430:typedef long int intmax_t; +// MSP430:typedef long unsigned int uintmax_t; +// +// MSP430:INT8_MAX_ 127 +// MSP430:INT8_MIN_ (-127 -1) +// MSP430:UINT8_MAX_ 255 +// MSP430:INT_LEAST8_MIN_ (-127 -1) +// MSP430:INT_LEAST8_MAX_ 127 +// MSP430:UINT_LEAST8_MAX_ 255 +// MSP430:INT_FAST8_MIN_ (-127 -1) +// MSP430:INT_FAST8_MAX_ 127 +// MSP430:UINT_FAST8_MAX_ 255 +// +// MSP430:INT16_MAX_ 32767 +// MSP430:INT16_MIN_ (-32767 -1) +// MSP430:UINT16_MAX_ 65535 +// MSP430:INT_LEAST16_MIN_ (-32767 -1) +// MSP430:INT_LEAST16_MAX_ 32767 +// MSP430:UINT_LEAST16_MAX_ 65535 +// MSP430:INT_FAST16_MIN_ (-32767 -1) +// MSP430:INT_FAST16_MAX_ 32767 +// MSP430:UINT_FAST16_MAX_ 65535 +// +// MSP430:INT32_MAX_ 2147483647L +// MSP430:INT32_MIN_ (-2147483647L -1) +// MSP430:UINT32_MAX_ 4294967295UL +// MSP430:INT_LEAST32_MIN_ (-2147483647L -1) +// MSP430:INT_LEAST32_MAX_ 2147483647L +// MSP430:UINT_LEAST32_MAX_ 4294967295UL +// MSP430:INT_FAST32_MIN_ (-2147483647L -1) +// MSP430:INT_FAST32_MAX_ 2147483647L +// MSP430:UINT_FAST32_MAX_ 4294967295UL +// +// MSP430:INT64_MAX_ 9223372036854775807LL +// MSP430:INT64_MIN_ (-9223372036854775807LL -1) +// MSP430:UINT64_MAX_ 18446744073709551615ULL +// MSP430:INT_LEAST64_MIN_ (-9223372036854775807LL -1) +// MSP430:INT_LEAST64_MAX_ 9223372036854775807LL +// MSP430:UINT_LEAST64_MAX_ 18446744073709551615ULL +// MSP430:INT_FAST64_MIN_ (-9223372036854775807LL -1) +// MSP430:INT_FAST64_MAX_ 9223372036854775807LL +// MSP430:UINT_FAST64_MAX_ 18446744073709551615ULL +// +// MSP430:INTPTR_MIN_ (-32767 -1) +// MSP430:INTPTR_MAX_ 32767 +// MSP430:UINTPTR_MAX_ 65535 +// MSP430:PTRDIFF_MIN_ (-32767 -1) +// MSP430:PTRDIFF_MAX_ 32767 +// MSP430:SIZE_MAX_ 65535 +// +// MSP430:INTMAX_MIN_ (-2147483647L -1) +// MSP430:INTMAX_MAX_ 2147483647L +// MSP430:UINTMAX_MAX_ 4294967295UL +// +// MSP430:SIG_ATOMIC_MIN_ (-2147483647L -1) +// MSP430:SIG_ATOMIC_MAX_ 2147483647L +// MSP430:WINT_MIN_ (-32767 -1) +// MSP430:WINT_MAX_ 32767 +// +// MSP430:WCHAR_MAX_ 32767 +// MSP430:WCHAR_MIN_ (-32767 -1) +// +// MSP430:INT8_C_(0) 0 +// MSP430:UINT8_C_(0) 0U +// MSP430:INT16_C_(0) 0 +// MSP430:UINT16_C_(0) 0U +// MSP430:INT32_C_(0) 0L +// MSP430:UINT32_C_(0) 0UL +// MSP430:INT64_C_(0) 0LL +// MSP430:UINT64_C_(0) 0ULL +// +// MSP430:INTMAX_C_(0) 0L +// MSP430:UINTMAX_C_(0) 0UL +// +// RUN: %clang_cc1 -E -ffreestanding -triple=powerpc64-none-none %s | FileCheck -check-prefix PPC64 %s +// +// PPC64:typedef signed long int int64_t; +// PPC64:typedef unsigned long int uint64_t; +// PPC64:typedef int64_t int_least64_t; +// PPC64:typedef uint64_t uint_least64_t; +// PPC64:typedef int64_t int_fast64_t; +// PPC64:typedef uint64_t uint_fast64_t; +// +// PPC64:typedef signed int int32_t; +// PPC64:typedef unsigned int uint32_t; +// PPC64:typedef int32_t int_least32_t; +// PPC64:typedef uint32_t uint_least32_t; +// PPC64:typedef int32_t int_fast32_t; +// PPC64:typedef uint32_t uint_fast32_t; +// +// PPC64:typedef signed short int16_t; +// PPC64:typedef unsigned short uint16_t; +// PPC64:typedef int16_t int_least16_t; +// PPC64:typedef uint16_t uint_least16_t; +// PPC64:typedef int16_t int_fast16_t; +// PPC64:typedef uint16_t uint_fast16_t; +// +// PPC64:typedef signed char int8_t; +// PPC64:typedef unsigned char uint8_t; +// PPC64:typedef int8_t int_least8_t; +// PPC64:typedef uint8_t uint_least8_t; +// PPC64:typedef int8_t int_fast8_t; +// PPC64:typedef uint8_t uint_fast8_t; +// +// PPC64:typedef int64_t intptr_t; +// PPC64:typedef uint64_t uintptr_t; +// +// PPC64:typedef long int intmax_t; +// PPC64:typedef long unsigned int uintmax_t; +// +// PPC64:INT8_MAX_ 127 +// PPC64:INT8_MIN_ (-127 -1) +// PPC64:UINT8_MAX_ 255 +// PPC64:INT_LEAST8_MIN_ (-127 -1) +// PPC64:INT_LEAST8_MAX_ 127 +// PPC64:UINT_LEAST8_MAX_ 255 +// PPC64:INT_FAST8_MIN_ (-127 -1) +// PPC64:INT_FAST8_MAX_ 127 +// PPC64:UINT_FAST8_MAX_ 255 +// +// PPC64:INT16_MAX_ 32767 +// PPC64:INT16_MIN_ (-32767 -1) +// PPC64:UINT16_MAX_ 65535 +// PPC64:INT_LEAST16_MIN_ (-32767 -1) +// PPC64:INT_LEAST16_MAX_ 32767 +// PPC64:UINT_LEAST16_MAX_ 65535 +// PPC64:INT_FAST16_MIN_ (-32767 -1) +// PPC64:INT_FAST16_MAX_ 32767 +// PPC64:UINT_FAST16_MAX_ 65535 +// +// PPC64:INT32_MAX_ 2147483647 +// PPC64:INT32_MIN_ (-2147483647 -1) +// PPC64:UINT32_MAX_ 4294967295U +// PPC64:INT_LEAST32_MIN_ (-2147483647 -1) +// PPC64:INT_LEAST32_MAX_ 2147483647 +// PPC64:UINT_LEAST32_MAX_ 4294967295U +// PPC64:INT_FAST32_MIN_ (-2147483647 -1) +// PPC64:INT_FAST32_MAX_ 2147483647 +// PPC64:UINT_FAST32_MAX_ 4294967295U +// +// PPC64:INT64_MAX_ 9223372036854775807L +// PPC64:INT64_MIN_ (-9223372036854775807L -1) +// PPC64:UINT64_MAX_ 18446744073709551615UL +// PPC64:INT_LEAST64_MIN_ (-9223372036854775807L -1) +// PPC64:INT_LEAST64_MAX_ 9223372036854775807L +// PPC64:UINT_LEAST64_MAX_ 18446744073709551615UL +// PPC64:INT_FAST64_MIN_ (-9223372036854775807L -1) +// PPC64:INT_FAST64_MAX_ 9223372036854775807L +// PPC64:UINT_FAST64_MAX_ 18446744073709551615UL +// +// PPC64:INTPTR_MIN_ (-9223372036854775807L -1) +// PPC64:INTPTR_MAX_ 9223372036854775807L +// PPC64:UINTPTR_MAX_ 18446744073709551615UL +// PPC64:PTRDIFF_MIN_ (-9223372036854775807L -1) +// PPC64:PTRDIFF_MAX_ 9223372036854775807L +// PPC64:SIZE_MAX_ 18446744073709551615UL +// +// PPC64:INTMAX_MIN_ (-9223372036854775807L -1) +// PPC64:INTMAX_MAX_ 9223372036854775807L +// PPC64:UINTMAX_MAX_ 18446744073709551615UL +// +// PPC64:SIG_ATOMIC_MIN_ (-2147483647 -1) +// PPC64:SIG_ATOMIC_MAX_ 2147483647 +// PPC64:WINT_MIN_ (-2147483647 -1) +// PPC64:WINT_MAX_ 2147483647 +// +// PPC64:WCHAR_MAX_ 2147483647 +// PPC64:WCHAR_MIN_ (-2147483647 -1) +// +// PPC64:INT8_C_(0) 0 +// PPC64:UINT8_C_(0) 0U +// PPC64:INT16_C_(0) 0 +// PPC64:UINT16_C_(0) 0U +// PPC64:INT32_C_(0) 0 +// PPC64:UINT32_C_(0) 0U +// PPC64:INT64_C_(0) 0L +// PPC64:UINT64_C_(0) 0UL +// +// PPC64:INTMAX_C_(0) 0L +// PPC64:UINTMAX_C_(0) 0UL +// +// RUN: %clang_cc1 -E -ffreestanding -triple=powerpc-none-none %s | FileCheck -check-prefix PPC %s +// +// +// PPC:typedef signed long long int int64_t; +// PPC:typedef unsigned long long int uint64_t; +// PPC:typedef int64_t int_least64_t; +// PPC:typedef uint64_t uint_least64_t; +// PPC:typedef int64_t int_fast64_t; +// PPC:typedef uint64_t uint_fast64_t; +// +// PPC:typedef signed int int32_t; +// PPC:typedef unsigned int uint32_t; +// PPC:typedef int32_t int_least32_t; +// PPC:typedef uint32_t uint_least32_t; +// PPC:typedef int32_t int_fast32_t; +// PPC:typedef uint32_t uint_fast32_t; +// +// PPC:typedef signed short int16_t; +// PPC:typedef unsigned short uint16_t; +// PPC:typedef int16_t int_least16_t; +// PPC:typedef uint16_t uint_least16_t; +// PPC:typedef int16_t int_fast16_t; +// PPC:typedef uint16_t uint_fast16_t; +// +// PPC:typedef signed char int8_t; +// PPC:typedef unsigned char uint8_t; +// PPC:typedef int8_t int_least8_t; +// PPC:typedef uint8_t uint_least8_t; +// PPC:typedef int8_t int_fast8_t; +// PPC:typedef uint8_t uint_fast8_t; +// +// PPC:typedef int32_t intptr_t; +// PPC:typedef uint32_t uintptr_t; +// +// PPC:typedef long long int intmax_t; +// PPC:typedef long long unsigned int uintmax_t; +// +// PPC:INT8_MAX_ 127 +// PPC:INT8_MIN_ (-127 -1) +// PPC:UINT8_MAX_ 255 +// PPC:INT_LEAST8_MIN_ (-127 -1) +// PPC:INT_LEAST8_MAX_ 127 +// PPC:UINT_LEAST8_MAX_ 255 +// PPC:INT_FAST8_MIN_ (-127 -1) +// PPC:INT_FAST8_MAX_ 127 +// PPC:UINT_FAST8_MAX_ 255 +// +// PPC:INT16_MAX_ 32767 +// PPC:INT16_MIN_ (-32767 -1) +// PPC:UINT16_MAX_ 65535 +// PPC:INT_LEAST16_MIN_ (-32767 -1) +// PPC:INT_LEAST16_MAX_ 32767 +// PPC:UINT_LEAST16_MAX_ 65535 +// PPC:INT_FAST16_MIN_ (-32767 -1) +// PPC:INT_FAST16_MAX_ 32767 +// PPC:UINT_FAST16_MAX_ 65535 +// +// PPC:INT32_MAX_ 2147483647 +// PPC:INT32_MIN_ (-2147483647 -1) +// PPC:UINT32_MAX_ 4294967295U +// PPC:INT_LEAST32_MIN_ (-2147483647 -1) +// PPC:INT_LEAST32_MAX_ 2147483647 +// PPC:UINT_LEAST32_MAX_ 4294967295U +// PPC:INT_FAST32_MIN_ (-2147483647 -1) +// PPC:INT_FAST32_MAX_ 2147483647 +// PPC:UINT_FAST32_MAX_ 4294967295U +// +// PPC:INT64_MAX_ 9223372036854775807LL +// PPC:INT64_MIN_ (-9223372036854775807LL -1) +// PPC:UINT64_MAX_ 18446744073709551615ULL +// PPC:INT_LEAST64_MIN_ (-9223372036854775807LL -1) +// PPC:INT_LEAST64_MAX_ 9223372036854775807LL +// PPC:UINT_LEAST64_MAX_ 18446744073709551615ULL +// PPC:INT_FAST64_MIN_ (-9223372036854775807LL -1) +// PPC:INT_FAST64_MAX_ 9223372036854775807LL +// PPC:UINT_FAST64_MAX_ 18446744073709551615ULL +// +// PPC:INTPTR_MIN_ (-2147483647 -1) +// PPC:INTPTR_MAX_ 2147483647 +// PPC:UINTPTR_MAX_ 4294967295U +// PPC:PTRDIFF_MIN_ (-2147483647 -1) +// PPC:PTRDIFF_MAX_ 2147483647 +// PPC:SIZE_MAX_ 4294967295U +// +// PPC:INTMAX_MIN_ (-9223372036854775807LL -1) +// PPC:INTMAX_MAX_ 9223372036854775807LL +// PPC:UINTMAX_MAX_ 18446744073709551615ULL +// +// PPC:SIG_ATOMIC_MIN_ (-2147483647 -1) +// PPC:SIG_ATOMIC_MAX_ 2147483647 +// PPC:WINT_MIN_ (-2147483647 -1) +// PPC:WINT_MAX_ 2147483647 +// +// PPC:WCHAR_MAX_ 2147483647 +// PPC:WCHAR_MIN_ (-2147483647 -1) +// +// PPC:INT8_C_(0) 0 +// PPC:UINT8_C_(0) 0U +// PPC:INT16_C_(0) 0 +// PPC:UINT16_C_(0) 0U +// PPC:INT32_C_(0) 0 +// PPC:UINT32_C_(0) 0U +// PPC:INT64_C_(0) 0LL +// PPC:UINT64_C_(0) 0ULL +// +// PPC:INTMAX_C_(0) 0LL +// PPC:UINTMAX_C_(0) 0ULL +// +// RUN: %clang_cc1 -E -ffreestanding -triple=sparc-none-none %s | FileCheck -check-prefix SPARC %s +// +// SPARC:typedef signed long long int int64_t; +// SPARC:typedef unsigned long long int uint64_t; +// SPARC:typedef int64_t int_least64_t; +// SPARC:typedef uint64_t uint_least64_t; +// SPARC:typedef int64_t int_fast64_t; +// SPARC:typedef uint64_t uint_fast64_t; +// +// SPARC:typedef signed int int32_t; +// SPARC:typedef unsigned int uint32_t; +// SPARC:typedef int32_t int_least32_t; +// SPARC:typedef uint32_t uint_least32_t; +// SPARC:typedef int32_t int_fast32_t; +// SPARC:typedef uint32_t uint_fast32_t; +// +// SPARC:typedef signed short int16_t; +// SPARC:typedef unsigned short uint16_t; +// SPARC:typedef int16_t int_least16_t; +// SPARC:typedef uint16_t uint_least16_t; +// SPARC:typedef int16_t int_fast16_t; +// SPARC:typedef uint16_t uint_fast16_t; +// +// SPARC:typedef signed char int8_t; +// SPARC:typedef unsigned char uint8_t; +// SPARC:typedef int8_t int_least8_t; +// SPARC:typedef uint8_t uint_least8_t; +// SPARC:typedef int8_t int_fast8_t; +// SPARC:typedef uint8_t uint_fast8_t; +// +// SPARC:typedef int32_t intptr_t; +// SPARC:typedef uint32_t uintptr_t; +// +// SPARC:typedef long long int intmax_t; +// SPARC:typedef long long unsigned int uintmax_t; +// +// SPARC:INT8_MAX_ 127 +// SPARC:INT8_MIN_ (-127 -1) +// SPARC:UINT8_MAX_ 255 +// SPARC:INT_LEAST8_MIN_ (-127 -1) +// SPARC:INT_LEAST8_MAX_ 127 +// SPARC:UINT_LEAST8_MAX_ 255 +// SPARC:INT_FAST8_MIN_ (-127 -1) +// SPARC:INT_FAST8_MAX_ 127 +// SPARC:UINT_FAST8_MAX_ 255 +// +// SPARC:INT16_MAX_ 32767 +// SPARC:INT16_MIN_ (-32767 -1) +// SPARC:UINT16_MAX_ 65535 +// SPARC:INT_LEAST16_MIN_ (-32767 -1) +// SPARC:INT_LEAST16_MAX_ 32767 +// SPARC:UINT_LEAST16_MAX_ 65535 +// SPARC:INT_FAST16_MIN_ (-32767 -1) +// SPARC:INT_FAST16_MAX_ 32767 +// SPARC:UINT_FAST16_MAX_ 65535 +// +// SPARC:INT32_MAX_ 2147483647 +// SPARC:INT32_MIN_ (-2147483647 -1) +// SPARC:UINT32_MAX_ 4294967295U +// SPARC:INT_LEAST32_MIN_ (-2147483647 -1) +// SPARC:INT_LEAST32_MAX_ 2147483647 +// SPARC:UINT_LEAST32_MAX_ 4294967295U +// SPARC:INT_FAST32_MIN_ (-2147483647 -1) +// SPARC:INT_FAST32_MAX_ 2147483647 +// SPARC:UINT_FAST32_MAX_ 4294967295U +// +// SPARC:INT64_MAX_ 9223372036854775807LL +// SPARC:INT64_MIN_ (-9223372036854775807LL -1) +// SPARC:UINT64_MAX_ 18446744073709551615ULL +// SPARC:INT_LEAST64_MIN_ (-9223372036854775807LL -1) +// SPARC:INT_LEAST64_MAX_ 9223372036854775807LL +// SPARC:UINT_LEAST64_MAX_ 18446744073709551615ULL +// SPARC:INT_FAST64_MIN_ (-9223372036854775807LL -1) +// SPARC:INT_FAST64_MAX_ 9223372036854775807LL +// SPARC:UINT_FAST64_MAX_ 18446744073709551615ULL +// +// SPARC:INTPTR_MIN_ (-2147483647 -1) +// SPARC:INTPTR_MAX_ 2147483647 +// SPARC:UINTPTR_MAX_ 4294967295U +// SPARC:PTRDIFF_MIN_ (-2147483647 -1) +// SPARC:PTRDIFF_MAX_ 2147483647 +// SPARC:SIZE_MAX_ 4294967295U +// +// SPARC:INTMAX_MIN_ (-9223372036854775807LL -1) +// SPARC:INTMAX_MAX_ 9223372036854775807LL +// SPARC:UINTMAX_MAX_ 18446744073709551615ULL +// +// SPARC:SIG_ATOMIC_MIN_ (-2147483647 -1) +// SPARC:SIG_ATOMIC_MAX_ 2147483647 +// SPARC:WINT_MIN_ (-2147483647 -1) +// SPARC:WINT_MAX_ 2147483647 +// +// SPARC:WCHAR_MAX_ 2147483647 +// SPARC:WCHAR_MIN_ (-2147483647 -1) +// +// SPARC:INT8_C_(0) 0 +// SPARC:UINT8_C_(0) 0U +// SPARC:INT16_C_(0) 0 +// SPARC:UINT16_C_(0) 0U +// SPARC:INT32_C_(0) 0 +// SPARC:UINT32_C_(0) 0U +// SPARC:INT64_C_(0) 0LL +// SPARC:UINT64_C_(0) 0ULL +// +// SPARC:INTMAX_C_(0) 0LL +// SPARC:UINTMAX_C_(0) 0ULL +// +// RUN: %clang_cc1 -E -ffreestanding -triple=tce-none-none %s | FileCheck -check-prefix TCE %s +// +// TCE:typedef signed int int32_t; +// TCE:typedef unsigned int uint32_t; +// TCE:typedef int32_t int_least32_t; +// TCE:typedef uint32_t uint_least32_t; +// TCE:typedef int32_t int_fast32_t; +// TCE:typedef uint32_t uint_fast32_t; +// +// TCE:typedef signed short int16_t; +// TCE:typedef unsigned short uint16_t; +// TCE:typedef int16_t int_least16_t; +// TCE:typedef uint16_t uint_least16_t; +// TCE:typedef int16_t int_fast16_t; +// TCE:typedef uint16_t uint_fast16_t; +// +// TCE:typedef signed char int8_t; +// TCE:typedef unsigned char uint8_t; +// TCE:typedef int8_t int_least8_t; +// TCE:typedef uint8_t uint_least8_t; +// TCE:typedef int8_t int_fast8_t; +// TCE:typedef uint8_t uint_fast8_t; +// +// TCE:typedef int32_t intptr_t; +// TCE:typedef uint32_t uintptr_t; +// +// TCE:typedef long int intmax_t; +// TCE:typedef long unsigned int uintmax_t; +// +// TCE:INT8_MAX_ 127 +// TCE:INT8_MIN_ (-127 -1) +// TCE:UINT8_MAX_ 255 +// TCE:INT_LEAST8_MIN_ (-127 -1) +// TCE:INT_LEAST8_MAX_ 127 +// TCE:UINT_LEAST8_MAX_ 255 +// TCE:INT_FAST8_MIN_ (-127 -1) +// TCE:INT_FAST8_MAX_ 127 +// TCE:UINT_FAST8_MAX_ 255 +// +// TCE:INT16_MAX_ 32767 +// TCE:INT16_MIN_ (-32767 -1) +// TCE:UINT16_MAX_ 65535 +// TCE:INT_LEAST16_MIN_ (-32767 -1) +// TCE:INT_LEAST16_MAX_ 32767 +// TCE:UINT_LEAST16_MAX_ 65535 +// TCE:INT_FAST16_MIN_ (-32767 -1) +// TCE:INT_FAST16_MAX_ 32767 +// TCE:UINT_FAST16_MAX_ 65535 +// +// TCE:INT32_MAX_ 2147483647 +// TCE:INT32_MIN_ (-2147483647 -1) +// TCE:UINT32_MAX_ 4294967295U +// TCE:INT_LEAST32_MIN_ (-2147483647 -1) +// TCE:INT_LEAST32_MAX_ 2147483647 +// TCE:UINT_LEAST32_MAX_ 4294967295U +// TCE:INT_FAST32_MIN_ (-2147483647 -1) +// TCE:INT_FAST32_MAX_ 2147483647 +// TCE:UINT_FAST32_MAX_ 4294967295U +// +// TCE:INT64_MAX_ INT64_MAX +// TCE:INT64_MIN_ INT64_MIN +// TCE:UINT64_MAX_ UINT64_MAX +// TCE:INT_LEAST64_MIN_ INT_LEAST64_MIN +// TCE:INT_LEAST64_MAX_ INT_LEAST64_MAX +// TCE:UINT_LEAST64_MAX_ UINT_LEAST64_MAX +// TCE:INT_FAST64_MIN_ INT_FAST64_MIN +// TCE:INT_FAST64_MAX_ INT_FAST64_MAX +// TCE:UINT_FAST64_MAX_ UINT_FAST64_MAX +// +// TCE:INTPTR_MIN_ (-2147483647 -1) +// TCE:INTPTR_MAX_ 2147483647 +// TCE:UINTPTR_MAX_ 4294967295U +// TCE:PTRDIFF_MIN_ (-2147483647 -1) +// TCE:PTRDIFF_MAX_ 2147483647 +// TCE:SIZE_MAX_ 4294967295U +// +// TCE:INTMAX_MIN_ (-2147483647 -1) +// TCE:INTMAX_MAX_ 2147483647 +// TCE:UINTMAX_MAX_ 4294967295U +// +// TCE:SIG_ATOMIC_MIN_ (-2147483647 -1) +// TCE:SIG_ATOMIC_MAX_ 2147483647 +// TCE:WINT_MIN_ (-2147483647 -1) +// TCE:WINT_MAX_ 2147483647 +// +// TCE:WCHAR_MAX_ 2147483647 +// TCE:WCHAR_MIN_ (-2147483647 -1) +// +// TCE:INT8_C_(0) 0 +// TCE:UINT8_C_(0) 0U +// TCE:INT16_C_(0) 0 +// TCE:UINT16_C_(0) 0U +// TCE:INT32_C_(0) 0 +// TCE:UINT32_C_(0) 0U +// TCE:INT64_C_(0) INT64_C(0) +// TCE:UINT64_C_(0) UINT64_C(0) +// +// TCE:INTMAX_C_(0) 0 +// TCE:UINTMAX_C_(0) 0U +// +// RUN: %clang_cc1 -E -ffreestanding -triple=x86_64-none-none %s | FileCheck -check-prefix X86_64 %s +// +// +// X86_64:typedef signed long int int64_t; +// X86_64:typedef unsigned long int uint64_t; +// X86_64:typedef int64_t int_least64_t; +// X86_64:typedef uint64_t uint_least64_t; +// X86_64:typedef int64_t int_fast64_t; +// X86_64:typedef uint64_t uint_fast64_t; +// +// X86_64:typedef signed int int32_t; +// X86_64:typedef unsigned int uint32_t; +// X86_64:typedef int32_t int_least32_t; +// X86_64:typedef uint32_t uint_least32_t; +// X86_64:typedef int32_t int_fast32_t; +// X86_64:typedef uint32_t uint_fast32_t; +// +// X86_64:typedef signed short int16_t; +// X86_64:typedef unsigned short uint16_t; +// X86_64:typedef int16_t int_least16_t; +// X86_64:typedef uint16_t uint_least16_t; +// X86_64:typedef int16_t int_fast16_t; +// X86_64:typedef uint16_t uint_fast16_t; +// +// X86_64:typedef signed char int8_t; +// X86_64:typedef unsigned char uint8_t; +// X86_64:typedef int8_t int_least8_t; +// X86_64:typedef uint8_t uint_least8_t; +// X86_64:typedef int8_t int_fast8_t; +// X86_64:typedef uint8_t uint_fast8_t; +// +// X86_64:typedef int64_t intptr_t; +// X86_64:typedef uint64_t uintptr_t; +// +// X86_64:typedef long int intmax_t; +// X86_64:typedef long unsigned int uintmax_t; +// +// X86_64:INT8_MAX_ 127 +// X86_64:INT8_MIN_ (-127 -1) +// X86_64:UINT8_MAX_ 255 +// X86_64:INT_LEAST8_MIN_ (-127 -1) +// X86_64:INT_LEAST8_MAX_ 127 +// X86_64:UINT_LEAST8_MAX_ 255 +// X86_64:INT_FAST8_MIN_ (-127 -1) +// X86_64:INT_FAST8_MAX_ 127 +// X86_64:UINT_FAST8_MAX_ 255 +// +// X86_64:INT16_MAX_ 32767 +// X86_64:INT16_MIN_ (-32767 -1) +// X86_64:UINT16_MAX_ 65535 +// X86_64:INT_LEAST16_MIN_ (-32767 -1) +// X86_64:INT_LEAST16_MAX_ 32767 +// X86_64:UINT_LEAST16_MAX_ 65535 +// X86_64:INT_FAST16_MIN_ (-32767 -1) +// X86_64:INT_FAST16_MAX_ 32767 +// X86_64:UINT_FAST16_MAX_ 65535 +// +// X86_64:INT32_MAX_ 2147483647 +// X86_64:INT32_MIN_ (-2147483647 -1) +// X86_64:UINT32_MAX_ 4294967295U +// X86_64:INT_LEAST32_MIN_ (-2147483647 -1) +// X86_64:INT_LEAST32_MAX_ 2147483647 +// X86_64:UINT_LEAST32_MAX_ 4294967295U +// X86_64:INT_FAST32_MIN_ (-2147483647 -1) +// X86_64:INT_FAST32_MAX_ 2147483647 +// X86_64:UINT_FAST32_MAX_ 4294967295U +// +// X86_64:INT64_MAX_ 9223372036854775807L +// X86_64:INT64_MIN_ (-9223372036854775807L -1) +// X86_64:UINT64_MAX_ 18446744073709551615UL +// X86_64:INT_LEAST64_MIN_ (-9223372036854775807L -1) +// X86_64:INT_LEAST64_MAX_ 9223372036854775807L +// X86_64:UINT_LEAST64_MAX_ 18446744073709551615UL +// X86_64:INT_FAST64_MIN_ (-9223372036854775807L -1) +// X86_64:INT_FAST64_MAX_ 9223372036854775807L +// X86_64:UINT_FAST64_MAX_ 18446744073709551615UL +// +// X86_64:INTPTR_MIN_ (-9223372036854775807L -1) +// X86_64:INTPTR_MAX_ 9223372036854775807L +// X86_64:UINTPTR_MAX_ 18446744073709551615UL +// X86_64:PTRDIFF_MIN_ (-9223372036854775807L -1) +// X86_64:PTRDIFF_MAX_ 9223372036854775807L +// X86_64:SIZE_MAX_ 18446744073709551615UL +// +// X86_64:INTMAX_MIN_ (-9223372036854775807L -1) +// X86_64:INTMAX_MAX_ 9223372036854775807L +// X86_64:UINTMAX_MAX_ 18446744073709551615UL +// +// X86_64:SIG_ATOMIC_MIN_ (-2147483647 -1) +// X86_64:SIG_ATOMIC_MAX_ 2147483647 +// X86_64:WINT_MIN_ (-2147483647 -1) +// X86_64:WINT_MAX_ 2147483647 +// +// X86_64:WCHAR_MAX_ 2147483647 +// X86_64:WCHAR_MIN_ (-2147483647 -1) +// +// X86_64:INT8_C_(0) 0 +// X86_64:UINT8_C_(0) 0U +// X86_64:INT16_C_(0) 0 +// X86_64:UINT16_C_(0) 0U +// X86_64:INT32_C_(0) 0 +// X86_64:UINT32_C_(0) 0U +// X86_64:INT64_C_(0) 0L +// X86_64:UINT64_C_(0) 0UL +// +// X86_64:INTMAX_C_(0) 0L +// X86_64:UINTMAX_C_(0) 0UL +// +// +// RUN: %clang_cc1 -E -ffreestanding -triple=x86_64-pc-linux-gnu %s | FileCheck -check-prefix X86_64_LINUX %s +// +// X86_64_LINUX:WINT_MIN_ 0U +// X86_64_LINUX:WINT_MAX_ 4294967295U +// +// +// RUN: %clang_cc1 -E -ffreestanding -triple=i386-mingw32 %s | FileCheck -check-prefix I386_MINGW32 %s +// +// I386_MINGW32:WCHAR_MAX_ 65535U +// I386_MINGW32:WCHAR_MIN_ 0U +// +// +// stdint.h forms several macro definitions by pasting together identifiers +// to form names (eg. int32_t is formed from int ## 32 ## _t). The following +// case tests that these joining operations are performed correctly even if +// the identifiers used in the operations (int, uint, _t, INT, UINT, _MIN, +// _MAX, and _C(v)) are themselves macros. +// +// RUN: %clang_cc1 -E -ffreestanding -U__UINTMAX_TYPE__ -U__INTMAX_TYPE__ -Dint=a -Duint=b -D_t=c -DINT=d -DUINT=e -D_MIN=f -D_MAX=g '-D_C(v)=h' -triple=i386-none-none %s | FileCheck -check-prefix JOIN %s +// JOIN:typedef int32_t intptr_t; +// JOIN:typedef uint32_t uintptr_t; +// JOIN:typedef __INTMAX_TYPE__ intmax_t; +// JOIN:typedef __UINTMAX_TYPE__ uintmax_t; +// JOIN:INTPTR_MIN_ (-2147483647 -1) +// JOIN:INTPTR_MAX_ 2147483647 +// JOIN:UINTPTR_MAX_ 4294967295U +// JOIN:PTRDIFF_MIN_ (-2147483647 -1) +// JOIN:PTRDIFF_MAX_ 2147483647 +// JOIN:SIZE_MAX_ 4294967295U +// JOIN:INTMAX_MIN_ (-9223372036854775807LL -1) +// JOIN:INTMAX_MAX_ 9223372036854775807LL +// JOIN:UINTMAX_MAX_ 18446744073709551615ULL +// JOIN:SIG_ATOMIC_MIN_ (-2147483647 -1) +// JOIN:SIG_ATOMIC_MAX_ 2147483647 +// JOIN:WINT_MIN_ (-2147483647 -1) +// JOIN:WINT_MAX_ 2147483647 +// JOIN:WCHAR_MAX_ 2147483647 +// JOIN:WCHAR_MIN_ (-2147483647 -1) +// JOIN:INTMAX_C_(0) 0LL +// JOIN:UINTMAX_C_(0) 0ULL + +#include + +INT8_MAX_ INT8_MAX +INT8_MIN_ INT8_MIN +UINT8_MAX_ UINT8_MAX +INT_LEAST8_MIN_ INT_LEAST8_MIN +INT_LEAST8_MAX_ INT_LEAST8_MAX +UINT_LEAST8_MAX_ UINT_LEAST8_MAX +INT_FAST8_MIN_ INT_FAST8_MIN +INT_FAST8_MAX_ INT_FAST8_MAX +UINT_FAST8_MAX_ UINT_FAST8_MAX + +INT16_MAX_ INT16_MAX +INT16_MIN_ INT16_MIN +UINT16_MAX_ UINT16_MAX +INT_LEAST16_MIN_ INT_LEAST16_MIN +INT_LEAST16_MAX_ INT_LEAST16_MAX +UINT_LEAST16_MAX_ UINT_LEAST16_MAX +INT_FAST16_MIN_ INT_FAST16_MIN +INT_FAST16_MAX_ INT_FAST16_MAX +UINT_FAST16_MAX_ UINT_FAST16_MAX + +INT32_MAX_ INT32_MAX +INT32_MIN_ INT32_MIN +UINT32_MAX_ UINT32_MAX +INT_LEAST32_MIN_ INT_LEAST32_MIN +INT_LEAST32_MAX_ INT_LEAST32_MAX +UINT_LEAST32_MAX_ UINT_LEAST32_MAX +INT_FAST32_MIN_ INT_FAST32_MIN +INT_FAST32_MAX_ INT_FAST32_MAX +UINT_FAST32_MAX_ UINT_FAST32_MAX + +INT64_MAX_ INT64_MAX +INT64_MIN_ INT64_MIN +UINT64_MAX_ UINT64_MAX +INT_LEAST64_MIN_ INT_LEAST64_MIN +INT_LEAST64_MAX_ INT_LEAST64_MAX +UINT_LEAST64_MAX_ UINT_LEAST64_MAX +INT_FAST64_MIN_ INT_FAST64_MIN +INT_FAST64_MAX_ INT_FAST64_MAX +UINT_FAST64_MAX_ UINT_FAST64_MAX + +INTPTR_MIN_ INTPTR_MIN +INTPTR_MAX_ INTPTR_MAX +UINTPTR_MAX_ UINTPTR_MAX +PTRDIFF_MIN_ PTRDIFF_MIN +PTRDIFF_MAX_ PTRDIFF_MAX +SIZE_MAX_ SIZE_MAX + +INTMAX_MIN_ INTMAX_MIN +INTMAX_MAX_ INTMAX_MAX +UINTMAX_MAX_ UINTMAX_MAX + +SIG_ATOMIC_MIN_ SIG_ATOMIC_MIN +SIG_ATOMIC_MAX_ SIG_ATOMIC_MAX +WINT_MIN_ WINT_MIN +WINT_MAX_ WINT_MAX + +WCHAR_MAX_ WCHAR_MAX +WCHAR_MIN_ WCHAR_MIN + +INT8_C_(0) INT8_C(0) +UINT8_C_(0) UINT8_C(0) +INT16_C_(0) INT16_C(0) +UINT16_C_(0) UINT16_C(0) +INT32_C_(0) INT32_C(0) +UINT32_C_(0) UINT32_C(0) +INT64_C_(0) INT64_C(0) +UINT64_C_(0) UINT64_C(0) + +INTMAX_C_(0) INTMAX_C(0) +UINTMAX_C_(0) UINTMAX_C(0) diff --git a/clang/test/Preprocessor/stringize_misc.c b/clang/test/Preprocessor/stringize_misc.c new file mode 100644 index 0000000..6c2c78d --- /dev/null +++ b/clang/test/Preprocessor/stringize_misc.c @@ -0,0 +1,30 @@ +// RUN: %clang_cc1 -E %s | FileCheck -strict-whitespace %s + +#define M(x, y) #x #y + +M( f(1, 2), g((x=y++, y))) +// CHECK: "f(1, 2)" "g((x=y++, y))" + +M( {a=1 , b=2;} ) /* A semicolon is not a comma */ +// CHECK: "{a=1" "b=2;}" + +M( <, [ ) /* Passes the arguments < and [ */ +// CHECK: "<" "[" + +M( (,), (...) ) /* Passes the arguments (,) and (...) */ +// CHECK: "(,)" "(...)" + +#define START_END(start, end) start c=3; end + +START_END( {a=1 , b=2;} ) /* braces are not parentheses */ +// CHECK: {a=1 c=3; b=2;} + +/* + * To pass a comma token as an argument it is + * necessary to write: + */ +#define COMMA , + +M(a COMMA b, (a, b)) +// CHECK: "a COMMA b" "(a, b)" + diff --git a/clang/test/Preprocessor/stringize_space.c b/clang/test/Preprocessor/stringize_space.c new file mode 100644 index 0000000..263cff8 --- /dev/null +++ b/clang/test/Preprocessor/stringize_space.c @@ -0,0 +1,4 @@ +// RUN: %clang_cc1 -E %s | grep -- '-"" , - "" , -"" , - ""' + +#define A(b) -#b , - #b , -# b , - # b +A() diff --git a/clang/test/Preprocessor/stringize_space2.c b/clang/test/Preprocessor/stringize_space2.c new file mode 100644 index 0000000..a87d78e --- /dev/null +++ b/clang/test/Preprocessor/stringize_space2.c @@ -0,0 +1,6 @@ +/* RUN: %clang_cc1 -E %s | grep 'a c' + */ +#define t(x) #x +t(a +c) + diff --git a/clang/test/Preprocessor/traditional-cpp.c b/clang/test/Preprocessor/traditional-cpp.c new file mode 100644 index 0000000..5fc9ee3 --- /dev/null +++ b/clang/test/Preprocessor/traditional-cpp.c @@ -0,0 +1,12 @@ +/* Clang supports a very limited subset of -traditional-cpp, basically we only + * intend to add support for things that people actually rely on when doing + * things like using /usr/bin/cpp to preprocess non-source files. */ + +/* + RUN: %clang_cc1 -traditional-cpp %s -E -o %t + RUN: FileCheck < %t %s +*/ + +/* CHECK: foo // bar + */ +foo // bar diff --git a/clang/test/Preprocessor/undef-error.c b/clang/test/Preprocessor/undef-error.c new file mode 100644 index 0000000..ad611de --- /dev/null +++ b/clang/test/Preprocessor/undef-error.c @@ -0,0 +1,5 @@ +// RUN: %clang_cc1 %s -pedantic-errors -verify +// PR2045 + +#define b +/* expected-error {{extra tokens at end of #undef directive}} */ #undef a b diff --git a/clang/test/Preprocessor/unterminated.c b/clang/test/Preprocessor/unterminated.c new file mode 100644 index 0000000..9180653 --- /dev/null +++ b/clang/test/Preprocessor/unterminated.c @@ -0,0 +1,5 @@ +// RUN: %clang_cc1 -E -verify %s +// PR3096 +#ifdef FOO // expected-error {{unterminated conditional directive}} +/* /* */ + diff --git a/clang/test/Preprocessor/user_defined_system_framework.c b/clang/test/Preprocessor/user_defined_system_framework.c new file mode 100644 index 0000000..8e3db56 --- /dev/null +++ b/clang/test/Preprocessor/user_defined_system_framework.c @@ -0,0 +1,8 @@ +// RUN: %clang -cc1 -fsyntax-only -F %S/Inputs -Wsign-conversion -verify %s + +// Check that TestFramework is treated as a system header. +#include + +int f1() { + return test_framework_func(1) + another_test_framework_func(2); +} diff --git a/clang/test/Preprocessor/warn-disabled-macro-expansion.c b/clang/test/Preprocessor/warn-disabled-macro-expansion.c new file mode 100644 index 0000000..fe8e90c --- /dev/null +++ b/clang/test/Preprocessor/warn-disabled-macro-expansion.c @@ -0,0 +1,27 @@ +// RUN: %clang_cc1 %s -E -Wdisabled-macro-expansion -verify + +#define p p + +#define a b +#define b a + +#define f(a) a + +#define g(b) a + +#define h(x) i(x) +#define i(y) i(y) + +#define c(x) x(0) + +p // expected-warning {{recursive macro}} + +a // expected-warning {{recursive macro}} + +f(2) + +g(3) // expected-warning {{recursive macro}} + +h(0) // expected-warning {{recursive macro}} + +c(c) // expected-warning {{recursive macro}} diff --git a/clang/test/Preprocessor/warn-macro-unused.c b/clang/test/Preprocessor/warn-macro-unused.c new file mode 100644 index 0000000..c33aeb5 --- /dev/null +++ b/clang/test/Preprocessor/warn-macro-unused.c @@ -0,0 +1,10 @@ +// RUN: %clang_cc1 %s -Wunused-macros -Dfoo -Dfoo -verify + +#include "warn-macro-unused.h" + +#define unused // expected-warning {{macro is not used}} +#define unused +unused + +// rdar://9745065 +#undef unused_from_header // no warning diff --git a/clang/test/Preprocessor/warn-macro-unused.h b/clang/test/Preprocessor/warn-macro-unused.h new file mode 100644 index 0000000..0c2c267 --- /dev/null +++ b/clang/test/Preprocessor/warn-macro-unused.h @@ -0,0 +1 @@ +#define unused_from_header diff --git a/clang/test/Preprocessor/warning_tests.c b/clang/test/Preprocessor/warning_tests.c new file mode 100644 index 0000000..96b96ef --- /dev/null +++ b/clang/test/Preprocessor/warning_tests.c @@ -0,0 +1,19 @@ +// RUN: %clang_cc1 -fsyntax-only %s -verify +#ifndef __has_warning +#error Should have __has_warning +#endif + +#if __has_warning("not valid") // expected-warning {{__has_warning expected option name}} +#endif + +#if __has_warning("-Wparentheses") +#warning Should have -Wparentheses // expected-warning {{Should have -Wparentheses}} +#endif + +#if __has_warning(-Wfoo) // expected-error {{builtin warning check macro requires a parenthesized string}} +#endif + +#if __has_warning("-Wnot-a-valid-warning-flag-at-all") +#else +#warning Not a valid warning flag // expected-warning {{Not a valid warning flag}} +#endif \ No newline at end of file diff --git a/clang/test/Preprocessor/x86_target_features.c b/clang/test/Preprocessor/x86_target_features.c new file mode 100644 index 0000000..ad7ee85 --- /dev/null +++ b/clang/test/Preprocessor/x86_target_features.c @@ -0,0 +1,32 @@ +// RUN: %clang -target i386-unknown-unknown -march=core2 -msse4 -x c -E -dM -o %t %s +// RUN: grep '#define __SSE2_MATH__ 1' %t +// RUN: grep '#define __SSE2__ 1' %t +// RUN: grep '#define __SSE3__ 1' %t +// RUN: grep '#define __SSE4_1__ 1' %t +// RUN: grep '#define __SSE4_2__ 1' %t +// RUN: grep '#define __SSE_MATH__ 1' %t +// RUN: grep '#define __SSE__ 1' %t +// RUN: grep '#define __SSSE3__ 1' %t + +// RUN: %clang -target i386-unknown-unknown -march=core2 -msse4 -mno-sse2 -x c -E -dM -o %t %s +// RUN: grep '#define __SSE2_MATH__ 1' %t | count 0 +// RUN: grep '#define __SSE2__ 1' %t | count 0 +// RUN: grep '#define __SSE3__ 1' %t | count 0 +// RUN: grep '#define __SSE4_1__ 1' %t | count 0 +// RUN: grep '#define __SSE4_2__ 1' %t | count 0 +// RUN: grep '#define __SSE_MATH__ 1' %t +// RUN: grep '#define __SSE__ 1' %t +// RUN: grep '#define __SSSE3__ 1' %t | count 0 + +// RUN: %clang -target i386-unknown-unknown -march=pentium-m -x c -E -dM -o %t %s +// RUN: grep '#define __SSE2_MATH__ 1' %t +// RUN: grep '#define __SSE2__ 1' %t +// RUN: grep '#define __SSE3__ 1' %t | count 0 +// RUN: grep '#define __SSE4_1__ 1' %t | count 0 +// RUN: grep '#define __SSE4_2__ 1' %t | count 0 +// RUN: grep '#define __SSE_MATH__ 1' %t +// RUN: grep '#define __SSE__ 1' %t +// RUN: grep '#define __SSSE3__ 1' %t | count 0 + + + -- cgit v1.2.3