diff options
| author | Ronan <ro.cailleau@gmail.com> | 2025-04-25 00:48:37 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-04-24 15:48:37 -0700 |
| commit | 5f632cd204b7a85f3a97b6c316c5a34f9fc8193e (patch) | |
| tree | 7dc74fbe8c80870a4c485bbaa5765ff379914779 /tests/preprocessor/pragma-warning/error-1.slang | |
| parent | c7ecf3039d2cc8680f1ea5f4bee2d13521ae34f7 (diff) | |
Implemented #pragma warning (#6748)
* Implemented #pragma warning
Based on https://learn.microsoft.com/en-us/cpp/preprocessor/warning?view=msvc-170
* Make #pragma warning work with #includes.
- SourceLoc are not sorted by inclusion order.
- Construct a mapping from SourceLoc to "absolute locations" that are sorted by inclusion order (roughly represents a location in a raw file with all #include resolved).
- The absolute location can be used in the pragma warning timeline
* Added preprocessor #pragma warning tests.
- Fixed #pragma warning (push / pop) SourceLoc
- Fixed unused directiveLoc in #pragma warning parsing
* #pragma warning: Added some comments and fixed some typos
* Cleaned #pragma warning preprocessor implementation.
---------
Co-authored-by: Yong He <yonghe@outlook.com>
Diffstat (limited to 'tests/preprocessor/pragma-warning/error-1.slang')
| -rw-r--r-- | tests/preprocessor/pragma-warning/error-1.slang | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/preprocessor/pragma-warning/error-1.slang b/tests/preprocessor/pragma-warning/error-1.slang new file mode 100644 index 000000000..a80e2bd89 --- /dev/null +++ b/tests/preprocessor/pragma-warning/error-1.slang @@ -0,0 +1,14 @@ +//TEST:SIMPLE(filecheck=CHECK): +// #ifdef support + +int64_t GetValue(); + +void f() +{ + int i; +#pragma warning (error : 30081) + // CHECK: ([[# @LINE+1]]): error 30081: + i = GetValue(); +} + +// Simple test of #pragma warning (error)
\ No newline at end of file |
