Posted by dmalcolm 3 days ago
Why not spend time on helping IDEs to understand error messages? That would be billion times more useful.
- I'd love to see godbolt examples of the sort of optimizations [[unsequenced]] and [[reproducible]] can do.
- GCC has always been in my experience smart enough to know how to optimize normal C code into ROL and ROR instructions. I've never had any issues with it. So what's the point of __builtin_stdc_rotate_left()? Why create a builtin when it is not needed? What I wish GCC and Clang would do instead, is formally document the magic ANSI C89 incantations that trigger the optimization, e.g. `#define ROL(x, n) (((x) << (n)) | ((x) >> (64 - (n))))`. That way we can have clean portable code with less #ifdef hell along with assurances it'll go fast when -O is passed.
- What is "Abs Without Undefined Behavior (addition of builtins for use in future C library <stdlib.h> headers)."?
- What is "Allow zero length operations on null pointers"?
- Re: "Introduce complex literals." How about some __int128 literals?
- "The "redzone" clobber is now allowed in inline assembler statements" wooo I've wanted something like this for a while.
Great work from the greatest compiler team!
There are _BitInt literals (wb and uwb), look adequate https://godbolt.org/z/xjEEM5Pa4 despite clang's "is a C23 extension" noise.
(BTW my terminal does not even support emojis.)
my $line = "infinite-loop-linked-list.c:30:10: warning: infinite loop [CWE-835] [-Wanalyzer-infinite-loop]";
grammar gcc {
token filename { <-[:]>+ };
token linenumber { \d+ };
token colnumber { \d+ };
token severity { info|warning|error };
token message { .* $$ };
regex diagnostic { <filename>
[\:] <linenumber>
[\:] <colnumber>
[\:]\s <severity>
[\:]\s <message>
};
token TOP { <diagnostic> };
}
say gcc.parse($line);
which when run produces the obvious output: 「infinite-loop-linked-list.c:30:10: warning: infinite loop [CWE-835] [-Wanalyzer-infinite-loop]」
diagnostic => 「infinite-loop-linked-list.c:30:10: warning: infinite loop [CWE-835] [-Wanalyzer-infinite-loop]」
filename => 「infinite-loop-linked-list.c」
linenumber => 「30」
colnumber => 「10」
severity => 「warning」
message => 「infinite loop [CWE-835] [-Wanalyzer-infinite-loop]」
I’ll leave handling filenames containing colons as an exercise for the reader.The emoji just focus the reader’s eye on the most critical line of the explanation.