{$MODESWITCH NESTEDCOMMENTS OFF} warnings. lazarus / 62-General ---------------------------------------------------------------------- 440bx · 2021-05-04 19:08 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 · 2021-05-04 19:18 Afaik if nested comments are off, you revert to TP comments, where a single closing } closes off multiple {'s. ---------------------------------------------------------------------- lucamar · 2021-05-04 19:32 Quote from: 440bx on May 04, 2021, 09:08:38 pmmy 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 "{") 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: [Select]-Sew : Compiler also halts after warnings 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 · 2021-05-04 19:36 Quote from: marcov on May 04, 2021, 09:18:40 pmAfaik if nested comments are off, you revert to TP comments, where a single closing } closes off multiple {'s. 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 pmProblem 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. Thank you lucamar.  Yes, that blanket "warning to error" mode could be "inconvenient".