[PATCH] D57207: [clang-tidy] Make google-objc-function-naming ignore implicit functions 🙈

Stephane Moore via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 8 18:49:10 PST 2019


stephanemoore marked an inline comment as done.
stephanemoore added inline comments.


================
Comment at: test/clang-tidy/google-objc-function-naming.m:3
 
+#import <stdio.h>
+
----------------
aaron.ballman wrote:
> stephanemoore wrote:
> > It turns out importing <stdio.h> is problematic and breaks the build (though everything built successfully for me locally 🤔). I believe that the import is not strictly necessary and I can embed a function declaration for `printf` to reproduce the implicit function declaration with the caveat that the check will trigger on a `printf` declaration that is not from a system header. I suppose it might be reasonable to suppress the check output on `printf`?
> > 
> > I have reverted this change for now and will follow up with appropriate fixes.
> > It turns out importing <stdio.h> is problematic and breaks the build (though everything built successfully for me locally 🤔).
> 
> Sorry about not catching that during review. I'm used to mentioning that you can't do `#include` but I didn't recall if the same was true for `#import`.
> 
> > I believe that the import is not strictly necessary and I can embed a function declaration for printf to reproduce the implicit function declaration with the caveat that the check will trigger on a printf declaration that is not from a system header. I suppose it might be reasonable to suppress the check output on printf?
> 
> You can use line markers to specify that the declaration is part of a system header with something like this:
> ```
> # 1 "system_header.h" 3
> int printf(const char *, ...);
> # 1 "google-objc-function-naming.m" 1
> ```
> (Note, you may need to pull a more decorated signature for `printf()` to be accurate.)
Thanks for the tip! I'll try that out and send out a followup!


Repository:
  rCTE Clang Tools Extra

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

https://reviews.llvm.org/D57207





More information about the cfe-commits mailing list