summaryrefslogtreecommitdiffstats
path: root/source/slang/options.cpp
diff options
context:
space:
mode:
authorTim Foley <tfoley@nvidia.com>2017-06-19 14:21:14 -0700
committerTim Foley <tfoley@nvidia.com>2017-06-19 14:25:17 -0700
commit19906b6501a1d5b35d2bd26817ca724c9528b8d2 (patch)
tree6648c6f5b308aa60c461a9e894406914660885ed /source/slang/options.cpp
parent838e8331da24744948539c12d2a8edcd9c594ee5 (diff)
Fixes for preprocessor conditionals that use macros
The basic underlying problem here is that the preprocessor tries to linger at the end of an input stream until it is sure it is time to advance. An input stream can include raw input files, or the expansion of a macro or macro argument. This was originally done to deal with not getting good end-of-line tokens when in directives (that issue has been fixed), but it is now a legacy issue that should probably be removed (but I am wary of making such a sweeping change). The problem that arises is that some code depends on what the actual input stream is (e.g., when turning conditionals on/off), and so we need to be careful. The bugs that this change affects arise when a `#if` or `#elseif` conditional expression *ends* with a macro expansion: #define FOO 2 #if 2 == FOO ... #endif When we try to start the preprocessor conditional block the "active" stream is still the expansion of `FOO`, when we needed it to be the input file. We fix this for now by snapshotting the input stream at the start of the directive, but a better long term fix would be to fix up this weird end-of-input behavior.
Diffstat (limited to 'source/slang/options.cpp')
0 files changed, 0 insertions, 0 deletions