Forum > General

{$MODESWITCH NESTEDCOMMENTS OFF} warnings.

(1/1)

440bx:
Hello,

When {$MODESWITCH NESTEDCOMMENTS OFF} is enabled and the compiler finds a mistakenly nested comment due to a missing "}" (a simple typo or oversight), the compiler tends to emit a  slew of warnings (usually one per comment line) until it reaches the end of the source file.

my question is: is there a way to tell the compiler to emit an error and stop the compilation at the first nested comment found ? (second unmatched curly brace "{")

Thank you for your help.

marcov:
Afaik if nested comments are off, you revert to TP comments, where a single closing } closes off multiple {'s.

lucamar:

--- Quote from: 440bx on May 04, 2021, 09:08:38 pm ---my question is: is there a way to tell the compiler to emit an error and stop the compilation at the first nested comment found ? (second unmatched curly brace "{")
--- End quote ---

I kind of remember there being an option to "treat warnings as errors" but I can't find it ATM. What I did find is this compiler option (which might be "it"):

--- Code: ----Sew : Compiler also halts after warnings
--- End code ---

Problem is that it affects *all* warnings and the compiler tends to emit tons of those for almost any non-trivial program %) so it might not be that useful to you if you want only that specific warning to stop compilation.

440bx:

--- Quote from: marcov on May 04, 2021, 09:18:40 pm ---Afaik if nested comments are off, you revert to TP comments, where a single closing } closes off multiple {'s.

--- End quote ---
Thank you marco. When I forget a closing curly brace, I get a sea of warnings about level 2 comments until the compiler reaches the end of the file.

It would be nice if there was a way to tell the compiler to stop whenever a second opening curly brace is found.  That's what I was hoping the modeswitch would do but, it doesn't do that. 


--- Quote from: lucamar on May 04, 2021, 09:32:45 pm ---Problem is that it affects *all* warnings and the compiler tends to emit tons of those for almost any non-trivial program %) so it might not be that useful to you if you want only that specific warning to stop compilation.

--- End quote ---
Thank you lucamar.  Yes, that blanket "warning to error" mode could be "inconvenient". <chuckle>

Navigation

[0] Message Index

Go to full version