Support __{FILE,LINE,DATE,TIME,TIMESTAMP}__ macros #125
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Context
It was pointed out in #124 that pnut doesn't support the
__FILE__
and__LINE__
built-in macros. This PR adds support for these macros and__{DATE,TIME,TIMESTAMP}__
for conformance with the standard.Support for
__FILE__
was relatively simple as we already keep track of the current file name. Same thing for__LINE__
as the line number is already computed whenINCLUDE_LINE_NUMBER_ON_ERROR
is activated (0 is used otherwise). The value for the other macros are hard coded to time 0 (Jan 1 1970
/00:00:00
) for simplicity.In principle (C99 standard document section 6.10.8), the
_ _STDC*_ _
macros should also be defined but pnut is far from respecting the full C99 standard so I think it's better to keep them undefined for now.