diff options
| author | Tim Foley <tfoleyNV@users.noreply.github.com> | 2018-08-27 12:33:35 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-08-27 12:33:35 -0700 |
| commit | 9a9733091cc7c9628e445313785d561deb229072 (patch) | |
| tree | c15aca8a54dc36ab5c1671591b86ae7e1895b382 /source/core/slang-random-generator.cpp | |
| parent | 6a8ad6eb4cab72c18de48762768e04d08b60a21c (diff) | |
Add basic support for #pragma once (#630)
* Improve diagnostic messages for function redefinition
The front-end was using internal "not implemented" errors instead of friendly user-facing errors to handle:
* Redefinition of a function (same signature and both have bodies)
* Multiple function declarations/definitions with the same parameter signature, but differnet return types
This change simply turns both of these into reasonably friendly errors that explain what went wrong and point to the previous definition/declaration as appropriate.
* Add support for detecting #pragma directives and handling them
The logic here mirrors what was set up for preprocessor directives, just for "sub-directives" in this case.
The only case here is the default one, which now reports a warning for directives we don't understand.
* Add basic support for #pragma once
Fixes #494
The approach here is simplistic in the extreme. When we see a `#pragma once` directive, we put the current file path (the location of the `#pragma` directive, as reported by our source manager) into a set, and then any paths in that set are ignored by subsequent `#include` directives.
This should work for simple cases of `#pragma once`, but it is likely to fail in a variety of cases because our filesystem layer currently makes no attempt to normalize/canonicalize paths. Improving the robustness of the solution is left to future work.
This change includes a simple test case to confirm that a second `#include` of a file with a `#pragma once` is successfully ignored.
Diffstat (limited to 'source/core/slang-random-generator.cpp')
0 files changed, 0 insertions, 0 deletions
