mirror of
https://github.com/cc65/cc65.git
synced 2024-12-24 11:31:31 +00:00
C++ style comments in C89 mode will cause errors only once per input file.
This commit is contained in:
parent
29c9cb3e00
commit
715aa919e6
@ -49,6 +49,7 @@ unsigned char DebugInfo = 0; /* Add debug info to the obj */
|
||||
unsigned char PreprocessOnly = 0; /* Just preprocess the input */
|
||||
unsigned char DebugOptOutput = 0; /* Output debug stuff */
|
||||
unsigned RegisterSpace = 6; /* Space available for register vars */
|
||||
unsigned AllowNewComments = 0; /* Allow new style comments in C89 mode */
|
||||
|
||||
/* Stackable options */
|
||||
IntStack WritableStrings = INTSTACK(0); /* Literal strings are r/w */
|
||||
|
@ -57,6 +57,7 @@ extern unsigned char DebugInfo; /* Add debug info to the obj */
|
||||
extern unsigned char PreprocessOnly; /* Just preprocess the input */
|
||||
extern unsigned char DebugOptOutput; /* Output debug stuff */
|
||||
extern unsigned RegisterSpace; /* Space available for register vars */
|
||||
extern unsigned AllowNewComments; /* Allow new style comments in C89 mode */
|
||||
|
||||
/* Stackable options */
|
||||
extern IntStack WritableStrings; /* Literal strings are r/w */
|
||||
|
@ -402,8 +402,10 @@ static void NewStyleComment (void)
|
||||
/* Remove a new style C comment from line. */
|
||||
{
|
||||
/* Diagnose if this is unsupported */
|
||||
if (IS_Get (&Standard) < STD_C99) {
|
||||
if (IS_Get (&Standard) < STD_C99 && !AllowNewComments) {
|
||||
PPError ("C++ style comments are not allowed in C89");
|
||||
PPNote ("(this will be reported only once per input file)");
|
||||
AllowNewComments = 1;
|
||||
}
|
||||
|
||||
/* Beware: Because line continuation chars are handled when reading
|
||||
@ -1800,6 +1802,9 @@ void PreprocessBegin (void)
|
||||
|
||||
/* Remember to update source file location in preprocess-only mode */
|
||||
FileChanged = 1;
|
||||
|
||||
/* Enable diagnostics on new style comments in C89 mode */
|
||||
AllowNewComments = 0;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user