[llvm-bugs] [Bug 51214] New: suggest including stdbool.h in C mode when missing definition of true/false, etc.
via llvm-bugs
llvm-bugs at lists.llvm.org
Mon Jul 26 01:51:07 PDT 2021
https://bugs.llvm.org/show_bug.cgi?id=51214
Bug ID: 51214
Summary: suggest including stdbool.h in C mode when missing
definition of true/false, etc.
Product: new-bugs
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: new bugs
Assignee: unassignedbugs at nondot.org
Reporter: hans at chromium.org
CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org
(From https://twitter.com/hansw2000/status/1419275810163331074)
Consider:
$ cat /tmp/a.c
#include <stdlib.h>
int foo();
int main() {
while (true) { if (foo() == 42) break; }
}
$ clang -c /tmp/a.c
/tmp/a.c:6:10: error: use of undeclared identifier 'true'; did you mean 'free'?
while (true) { if (foo() == 42) break; }
^~~~
free
/usr/include/stdlib.h:565:13: note: 'free' declared here
extern void free (void *__ptr) __THROW;
^
1 error generated.
The "did you mean 'free'" hint is amusing, but it would be more helpful if
clang suggested including stdbool.h here, like it does with many standard
library functions.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210726/41e20212/attachment.html>
More information about the llvm-bugs
mailing list