-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
meson: Add more tests for system includes
- Loading branch information
Showing
4 changed files
with
43 additions
and
0 deletions.
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
test cases/linuxlike/16 isystem includes/global_include/my_global_lib/my_global.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#pragma once | ||
|
||
#include <stdbool.h> | ||
|
||
/* Attempt to trigger -Wsizeof-array-div */ | ||
extern int arr1[10]; | ||
const int C0 = sizeof(arr1) / sizeof(short); |
7 changes: 7 additions & 0 deletions
7
test cases/linuxlike/16 isystem includes/local_include1/my_local1_lib/my_local1.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#pragma once | ||
|
||
#include <stdbool.h> | ||
|
||
/* Attempt to trigger -Wsizeof-array-div */ | ||
extern int arr1[10]; | ||
const int C1 = sizeof(arr1) / sizeof(short); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#include <my_global_lib/my_global.h> | ||
#include <my_local1_lib/my_local1.h> | ||
|
||
int main() { | ||
return C0 + C1; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
project('isystem includes', 'c', default_options : 'werror=true') | ||
|
||
cc = meson.get_compiler('c') | ||
|
||
# Canary warning to check suppression in system headers. Chosen randomly from GCC docs. | ||
incwarg = '-Wsizeof-array-div' | ||
|
||
add_project_dependencies( | ||
declare_dependency( | ||
include_directories: include_directories('global_include', is_system: true), | ||
), | ||
language: ['c'], | ||
) | ||
|
||
local_inc_dep1 = declare_dependency( | ||
include_directories: 'local_include1', | ||
).as_system().partial_dependency(includes : true) | ||
|
||
if cc.has_argument(incwarg) | ||
executable('main', 'main.c', c_args: incwarg, dependencies: local_inc_dep1) | ||
else | ||
error('MESON_SKIP_TEST compiler does not support emitting canary warning.') | ||
endif |