Warning when running syntax check on C++ header file

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Warning when running syntax check on C++ header file

Robinson, Paul via cfe-dev
I'm trying to run a syntax check on a C++ header file with .h extension
and get a warning:

$ cat foo.h
class Foo {};
$ clang++ -fsyntax-only foo.h
clang-5.0: warning: treating 'c-header' input as 'c++-header' when in
C++ mode, this behavior is deprecated [-Wdeprecated]
$ clang++ --version
clang version 5.0.0 (tags/RELEASE_500/final)
Target: x86_64-apple-darwin17.2.0
Thread model: posix

Why is this, shouldn't Clang assume it's a C++ header since I invoked
the compiler using "clang++"?

If I add "-x c++" I don't get the warning.

I'm no C++ expert but most C++ libraries I've seen are using .h as the
extension for the header files.

--
/Jacob Carlborg

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev