Richard Smith | ea74148 | 2017-05-01 22:10:47 +0000 | [diff] [blame] | 1 | // RUN: rm -rf %t |
| 2 | // |
Richard Smith | e37391c | 2017-05-03 00:28:49 +0000 | [diff] [blame] | 3 | // For an implicit module, all that matters are the warning flags in the user. |
| 4 | // RUN: %clang_cc1 -triple %itanium_abi_triple -fmodules -fimplicit-module-maps -emit-module -fmodules-cache-path=%t -fmodule-name=diag_flags -x c++ %S/Inputs/module.map -fmodules-ts |
| 5 | // RUN: %clang_cc1 -triple %itanium_abi_triple -fmodules -fimplicit-module-maps -verify -fmodules-cache-path=%t -I %S/Inputs %s -fmodules-ts |
Richard Smith | 6c2b5a8 | 2018-02-09 01:15:13 +0000 | [diff] [blame] | 6 | // RUN: %clang_cc1 -triple %itanium_abi_triple -fmodules -fimplicit-module-maps -verify -fmodules-cache-path=%t -I %S/Inputs %s -fmodules-ts -DWARNING -DLOCAL_WARNING -Wpadded |
| 7 | // RUN: %clang_cc1 -triple %itanium_abi_triple -fmodules -fimplicit-module-maps -verify -fmodules-cache-path=%t -I %S/Inputs %s -fmodules-ts -DERROR -DLOCAL_ERROR -Wpadded -Werror |
| 8 | // RUN: %clang_cc1 -triple %itanium_abi_triple -fmodules -fimplicit-module-maps -verify -fmodules-cache-path=%t -I %S/Inputs %s -fmodules-ts -DERROR -DLOCAL_ERROR -Werror=padded |
Richard Smith | ea74148 | 2017-05-01 22:10:47 +0000 | [diff] [blame] | 9 | // |
Richard Smith | e37391c | 2017-05-03 00:28:49 +0000 | [diff] [blame] | 10 | // For an explicit module, all that matters are the warning flags in the module build. |
| 11 | // RUN: %clang_cc1 -triple %itanium_abi_triple -fmodules -fimplicit-module-maps -emit-module -fmodule-name=diag_flags -x c++ %S/Inputs/module.map -fmodules-ts -o %t/nodiag.pcm |
Richard Smith | 6c2b5a8 | 2018-02-09 01:15:13 +0000 | [diff] [blame] | 12 | // RUN: %clang_cc1 -triple %itanium_abi_triple -fmodules -fimplicit-module-maps -verify -fmodules-cache-path=%t -I %S/Inputs %s -fmodules-ts -fmodule-file=%t/nodiag.pcm -Wpadded -DLOCAL_WARNING |
| 13 | // RUN: %clang_cc1 -triple %itanium_abi_triple -fmodules -fimplicit-module-maps -verify -fmodules-cache-path=%t -I %S/Inputs %s -fmodules-ts -fmodule-file=%t/nodiag.pcm -Werror -Wpadded -DLOCAL_ERROR |
Richard Smith | e37391c | 2017-05-03 00:28:49 +0000 | [diff] [blame] | 14 | // |
| 15 | // RUN: %clang_cc1 -triple %itanium_abi_triple -fmodules -fimplicit-module-maps -emit-module -fmodule-name=diag_flags -x c++ %S/Inputs/module.map -fmodules-ts -o %t/warning.pcm -Wpadded |
| 16 | // RUN: %clang_cc1 -triple %itanium_abi_triple -fmodules -fimplicit-module-maps -verify -fmodules-cache-path=%t -I %S/Inputs %s -fmodules-ts -DWARNING -fmodule-file=%t/warning.pcm |
Richard Smith | 6c2b5a8 | 2018-02-09 01:15:13 +0000 | [diff] [blame] | 17 | // RUN: %clang_cc1 -triple %itanium_abi_triple -fmodules -fimplicit-module-maps -verify -fmodules-cache-path=%t -I %S/Inputs %s -fmodules-ts -DWARNING -fmodule-file=%t/warning.pcm -Werror=padded -DLOCAL_ERROR |
Richard Smith | e37391c | 2017-05-03 00:28:49 +0000 | [diff] [blame] | 18 | // RUN: %clang_cc1 -triple %itanium_abi_triple -fmodules -fimplicit-module-maps -verify -fmodules-cache-path=%t -I %S/Inputs %s -fmodules-ts -DWARNING -fmodule-file=%t/warning.pcm -Werror |
| 19 | // |
| 20 | // RUN: %clang_cc1 -triple %itanium_abi_triple -fmodules -fimplicit-module-maps -emit-module -fmodule-name=diag_flags -x c++ %S/Inputs/module.map -fmodules-ts -o %t/werror-no-error.pcm -Werror -Wpadded -Wno-error=padded |
| 21 | // RUN: %clang_cc1 -triple %itanium_abi_triple -fmodules -fimplicit-module-maps -verify -fmodules-cache-path=%t -I %S/Inputs %s -fmodules-ts -DWARNING -fmodule-file=%t/werror-no-error.pcm |
| 22 | // RUN: %clang_cc1 -triple %itanium_abi_triple -fmodules -fimplicit-module-maps -verify -fmodules-cache-path=%t -I %S/Inputs %s -fmodules-ts -DWARNING -fmodule-file=%t/werror-no-error.pcm -Wno-padded |
Richard Smith | 6c2b5a8 | 2018-02-09 01:15:13 +0000 | [diff] [blame] | 23 | // RUN: %clang_cc1 -triple %itanium_abi_triple -fmodules -fimplicit-module-maps -verify -fmodules-cache-path=%t -I %S/Inputs %s -fmodules-ts -DWARNING -fmodule-file=%t/werror-no-error.pcm -Werror=padded -DLOCAL_ERROR |
Richard Smith | e37391c | 2017-05-03 00:28:49 +0000 | [diff] [blame] | 24 | // |
| 25 | // RUN: %clang_cc1 -triple %itanium_abi_triple -fmodules -fimplicit-module-maps -emit-module -fmodule-name=diag_flags -x c++ %S/Inputs/module.map -fmodules-ts -o %t/error.pcm -Werror=padded |
| 26 | // RUN: %clang_cc1 -triple %itanium_abi_triple -fmodules -fimplicit-module-maps -verify -fmodules-cache-path=%t -I %S/Inputs %s -fmodules-ts -DERROR -fmodule-file=%t/error.pcm -Wno-padded |
| 27 | // RUN: %clang_cc1 -triple %itanium_abi_triple -fmodules -fimplicit-module-maps -verify -fmodules-cache-path=%t -I %S/Inputs %s -fmodules-ts -DERROR -fmodule-file=%t/error.pcm -Wno-error=padded |
| 28 | // |
| 29 | // RUN: %clang_cc1 -triple %itanium_abi_triple -fmodules -fimplicit-module-maps -emit-module -fmodule-name=diag_flags -x c++ %S/Inputs/module.map -fmodules-ts -o %t/werror.pcm -Werror -Wpadded |
| 30 | // RUN: %clang_cc1 -triple %itanium_abi_triple -fmodules -fimplicit-module-maps -verify -fmodules-cache-path=%t -I %S/Inputs %s -fmodules-ts -DERROR -fmodule-file=%t/werror.pcm -Wno-error |
| 31 | // RUN: %clang_cc1 -triple %itanium_abi_triple -fmodules -fimplicit-module-maps -verify -fmodules-cache-path=%t -I %S/Inputs %s -fmodules-ts -DERROR -fmodule-file=%t/werror.pcm -Wno-padded |
Richard Smith | ea74148 | 2017-05-01 22:10:47 +0000 | [diff] [blame] | 32 | |
| 33 | import diag_flags; |
| 34 | |
| 35 | // Diagnostic flags from the module user make no difference to diagnostics |
| 36 | // emitted within the module when using an explicitly-loaded module. |
Richard Smith | e37391c | 2017-05-03 00:28:49 +0000 | [diff] [blame] | 37 | #if ERROR |
Richard Smith | 6c2b5a8 | 2018-02-09 01:15:13 +0000 | [diff] [blame] | 38 | // expected-error@diag_flags.h:4 {{padding struct}} |
Richard Smith | e37391c | 2017-05-03 00:28:49 +0000 | [diff] [blame] | 39 | #elif WARNING |
Richard Smith | 6c2b5a8 | 2018-02-09 01:15:13 +0000 | [diff] [blame] | 40 | // expected-warning@diag_flags.h:4 {{padding struct}} |
Richard Smith | ea74148 | 2017-05-01 22:10:47 +0000 | [diff] [blame] | 41 | #endif |
Richard Smith | 96b96c8 | 2017-06-27 00:22:07 +0000 | [diff] [blame] | 42 | int arr[sizeof(Padded)]; |
Richard Smith | 6c2b5a8 | 2018-02-09 01:15:13 +0000 | [diff] [blame] | 43 | |
| 44 | // Diagnostic flags from the module make no difference to diagnostics emitted |
| 45 | // in the module user. |
| 46 | #if LOCAL_ERROR |
| 47 | // expected-error@+4 {{padding struct}} |
| 48 | #elif LOCAL_WARNING |
| 49 | // expected-warning@+2 {{padding struct}} |
| 50 | #endif |
| 51 | struct Padded2 { char x; int y; }; |
| 52 | int arr2[sizeof(Padded2)]; |
| 53 | |
| 54 | #if !ERROR && !WARNING && !LOCAL_ERROR && !LOCAL_WARNING |
| 55 | // expected-no-diagnostics |
| 56 | #endif |