[PATCH] D58091: Customize warnings for missing built-in type

Richard Smith - zygoloid via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 13 15:39:26 PST 2019


rsmith added inline comments.


================
Comment at: clang/include/clang/Basic/DiagnosticSemaKinds.td:591
+def warn_implicit_decl_no_jmp_buf
+    : Warning<"declaration of built-in '%0' requires the definition of the "
+              "'jmp_buf' type">,
----------------
We only require a declaration of `jmp_buf`, not a definition. And please retain the word "function" after "built-in".


================
Comment at: clang/lib/Sema/SemaDecl.cpp:1971
           << Context.BuiltinInfo.getName(ID);
+      return nullptr;
+    }
----------------
It'd be nice to produce `note_include_header_or_declare` here. (Ideally, that note should be suppressed if we're transitively in a header with the right name already, but I think it'll be clear enough what's wrong even if we produce the note unconditionally.)


================
Comment at: clang/test/Sema/builtin-setjmp.c:4-10
+#ifdef NO_JMP_BUF
+extern long setjmp(long *);   // no_jmp_buf-warning {{declaration of built-in 'setjmp' requires the definition of the 'jmp_buf' type}}
+#else
+typedef long jmp_buf;
+extern int setjmp(char);      // redecl-warning at 8 {{incompatible redeclaration of library function 'setjmp'}}
+                              // redecl-note at 8    {{'setjmp' is a builtin with type 'int (jmp_buf)' (aka 'int (long)')}}
+#endif
----------------
You don't need custom `-verify` prefixes for this (`-verify` respects `#ifdef`s); just use `expected`.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D58091/new/

https://reviews.llvm.org/D58091





More information about the cfe-commits mailing list