[Bug c/115496] RFE: new warning to detect suspicious multiline string literals
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115496 Eric Gallager changed: What|Removed |Added CC||egallager at gcc dot gnu.org See Also||https://gcc.gnu.org/bugzill ||a/show_bug.cgi?id=99131 --- Comment #7 from Eric Gallager --- Semi-related: bug 99131 (for the case of missing commas)
[Bug c/115496] RFE: new warning to detect suspicious multiline string literals
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115496 --- Comment #6 from Andi Kleen --- Yes a # check would need to be target dependent.
[Bug c/115496] RFE: new warning to detect suspicious multiline string literals
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115496 Andrew Pinski changed: What|Removed |Added Blocks||87403 Severity|normal |enhancement Referenced Bugs: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87403 [Bug 87403] [Meta-bug] Issues that suggest a new warning
[Bug c/115496] RFE: new warning to detect suspicious multiline string literals
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115496 --- Comment #5 from Andrew Pinski --- # can also start a number in aarch64 and arm assembly and not a comment. So NO `#` is not universally starts a comment.
[Bug c/115496] RFE: new warning to detect suspicious multiline string literals
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115496 --- Comment #4 from David Malcolm --- A possible input to the logic could be: be more paranoid about strings that will be used by inline asm. (In reply to Andi Kleen from comment #3) > When writing inline assembler an alternative to \n is to use ; as separator > > e.g. > > asm("movl $1,%eax ; " > "movl %eax,%ebx") > > there can be also comment mistake here like > > > asm("movl $1,%eax # comment ;" > "movl %eax,%ebx"); > > This incorrectly drops the second instruction. The \n warning wouldn't > handle that case, it would need knowledge about # comments. Yeah. However we've traditionally avoided looking within the body of the inline assembler. I wonder if the use of '#' and ';' in asm sufficiently standardized to be checkable (or if this way lies madness)
[Bug c/115496] RFE: new warning to detect suspicious multiline string literals
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115496 --- Comment #3 from Andi Kleen --- When writing inline assembler an alternative to \n is to use ; as separator e.g. asm("movl $1,%eax ; " "movl %eax,%ebx") there can be also comment mistake here like asm("movl $1,%eax # comment ;" "movl %eax,%ebx"); This incorrectly drops the second instruction. The \n warning wouldn't handle that case, it would need knowledge about # comments. I've hit that problem in some real code. Always preferred to write ; over \n because it looks less ugly.