-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #27785 from jbytheway/iwyu_vs_fixes
IWYU support (part 3): Improve Visual Studio compatibility
- Loading branch information
Showing
8 changed files
with
34 additions
and
10 deletions.
There are no files selected for viewing
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
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,17 @@ | ||
#ifndef CATA_MATH_DEFINES_H | ||
#define CATA_MATH_DEFINES_H | ||
|
||
// On Visual Studio math.h only provides the defines (M_PI, etc.) if | ||
// _USE_MATH_DEFINES is defined before including it. | ||
// We centralize that requirement in this header so that IWYU can force this | ||
// header to be included when such defines are used, via mappings. | ||
// At time of writing only M_PI has a mapping, which is the most commonly used | ||
// one. If more are needed, add them to tools/iwyu/vs.stdlib.imp. | ||
|
||
// Note that it's important to use math.h here, not cmath. See | ||
// https://stackoverflow.com/questions/6563810/m-pi-works-with-math-h-but-not-with-cmath-in-visual-studio/6563891 | ||
|
||
#define _USE_MATH_DEFINES | ||
#include <math.h> | ||
|
||
#endif // CATA_MATH_DEFINES_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
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
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
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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
[ | ||
{ ref: "gcc.stdlib.imp" }, | ||
{ ref: "vs.stdlib.imp" }, | ||
{ ref: "sdl.imp" }, | ||
] |
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
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,5 @@ | ||
[ | ||
{ symbol: ["M_PI", "private", "\"math_defines.h\"", "public"] }, | ||
{ symbol: ["nanosleep", "private", "\"posix_time.h\"", "public"] }, | ||
{ symbol: ["timespec", "private", "\"posix_time.h\"", "public"] }, | ||
] |