[PATCH] D44093: [BUILTINS] structure pretty printer

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 9 15:28:12 PDT 2018


aaron.ballman added inline comments.


================
Comment at: test/Sema/builtin-dump-struct.c:8
+  void *b;
+  int (*goodfunc)(const char *, ...);
+  int (*badfunc1)(const char *);
----------------
paulsemel wrote:
> aaron.ballman wrote:
> > paulsemel wrote:
> > > aaron.ballman wrote:
> > > > Can you also add a test for: `int (*badfunc4)(char *, ...);` and `int (*badfunc5)();`
> > > Isn't `int (*func)()` is a valid prototype for a printf like function in C ?
> > > I instead added `int (*func)(void)` to the test cases.
> > > Isn't int (*func)() is a valid prototype for a printf like function in C ?
> > 
> > No, because it's missing the `const char *` as the mandatory first parameter. Do you want that to be allowed and hope the callee has it correct on their side, or do you want it to diagnose as not being a valid function?
> Actually, from a kernel developer perspective, I would say it's better to let the user do its stuff on his side, because kernel is full of trick !
> But if you think I'd rather check whether we have `int (*)(const char *, ...)` at any time, we can go for it !
Okay, if you think it'd be beneficial to allow a function without a prototype, I'm okay with it. Can you make it an explicit "good" test case?


Repository:
  rC Clang

https://reviews.llvm.org/D44093





More information about the cfe-commits mailing list