Getting errors of the form "<blah> is a C++11 extension" when trying to build clang plugin

RESOLVED INVALID

Status

Firefox Build System
Source Code Analysis
RESOLVED INVALID
3 years ago
2 months ago

People

(Reporter: botond, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

3 years ago
I'm trying to build m-c trunk with --enable-clang-plugin, but getting these errors.

It looks like the build system isn't passing -std=c++11 to the invocation of the compiler command that builds the plugin.

My OS is Kubuntu 14.04 LTS; clang version is 3.4.


 0:34.92 From _tests: Kept 28 existing; Added/updated 41543; Removed 0 files and 0 directories.
 0:35.18 clang-plugin.o
 0:38.43 /home/botond/dev/mozilla/central/build/clang-plugin/clang-plugin.cpp:145:9: error: 'auto' type specifier is a C++11 extension [-Werror,-Wc++11-extensions]
 0:38.43   const auto &name = ND->getName();
 0:38.43         ^
 0:38.43 /home/botond/dev/mozilla/central/build/clang-plugin/clang-plugin.cpp:323:25: error: 'final' keyword is a C++11 extension [-Werror,-Wc++11-extensions]
 0:38.43 class MemMoveAnnotation final : public CustomTypeAnnotation {
 0:38.43                         ^
 0:38.43 /home/botond/dev/mozilla/central/build/clang-plugin/clang-plugin.cpp:331:50: error: 'override' keyword is a C++11 extension [-Werror,-Wc++11-extensions]
 0:38.43   bool hasFakeAnnotation(const TagDecl *D) const override {
 0:38.43                                                  ^
 0:38.43 /home/botond/dev/mozilla/central/build/clang-plugin/clang-plugin.cpp:364:5: error: use of undeclared identifier 'iterator_range'
 0:38.43     iterator_range<specific_attr_iterator<AnnotateAttr>> Attrs =
 0:38.43     ^
 0:38.43 /home/botond/dev/mozilla/central/build/clang-plugin/clang-plugin.cpp:364:55: error: a space is required between consecutive right angle brackets (use '> >')
 0:38.43     iterator_range<specific_attr_iterator<AnnotateAttr>> Attrs =
 0:38.43                                                       ^~
 0:38.43                                                       > >
 0:38.43 /home/botond/dev/mozilla/central/build/clang-plugin/clang-plugin.cpp:364:56: error: expected '(' for function-style cast or type construction
 0:38.43     iterator_range<specific_attr_iterator<AnnotateAttr>> Attrs =
 0:38.43                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
 0:38.43 /home/botond/dev/mozilla/central/build/clang-plugin/clang-plugin.cpp:364:58: error: use of undeclared identifier 'Attrs'
 0:38.43     iterator_range<specific_attr_iterator<AnnotateAttr>> Attrs =
 0:38.43                                                          ^
 0:38.43 /home/botond/dev/mozilla/central/build/clang-plugin/clang-plugin.cpp:365:12: error: no template named 'specific_attrs' in 'clang::Decl'; did you mean 'specific_attr_end'?
 0:38.43         D->specific_attrs<AnnotateAttr>();
 0:38.43            ^~~~~~~~~~~~~~
 0:38.43            specific_attr_end
 0:38.43 /usr/lib/llvm-3.4/include/clang/AST/DeclBase.h:474:29: note: 'specific_attr_end' declared here
 0:38.43   specific_attr_iterator<T> specific_attr_end() const {
 0:38.43                             ^
 0:38.44 /home/botond/dev/mozilla/central/build/clang-plugin/clang-plugin.cpp:365:12: error: no template named 'specific_attrs' in 'clang::Decl'; did you mean 'specific_attr_end'?
 0:38.44         D->specific_attrs<AnnotateAttr>();
 0:38.44            ^~~~~~~~~~~~~~
 0:38.44            specific_attr_end
 0:38.44 /usr/lib/llvm-3.4/include/clang/AST/DeclBase.h:474:29: note: 'specific_attr_end' declared here
 0:38.44   specific_attr_iterator<T> specific_attr_end() const {
 0:38.44                             ^
 0:38.44 /home/botond/dev/mozilla/central/build/clang-plugin/clang-plugin.cpp:365:12: error: no member named 'specific_attrs' in 'clang::Decl'; did you mean 'specific_attr_end'?
 0:38.44         D->specific_attrs<AnnotateAttr>();
 0:38.44            ^~~~~~~~~~~~~~
 0:38.44            specific_attr_end
 0:38.44 /usr/lib/llvm-3.4/include/clang/AST/DeclBase.h:474:29: note: 'specific_attr_end' declared here
 0:38.44   specific_attr_iterator<T> specific_attr_end() const {
 0:38.44                             ^
 0:38.44 /home/botond/dev/mozilla/central/build/clang-plugin/clang-plugin.cpp:365:27: error: 'AnnotateAttr' does not refer to a value
 0:38.44         D->specific_attrs<AnnotateAttr>();
 0:38.44                           ^
 0:38.44 /usr/lib/llvm-3.4/include/clang/AST/Attrs.inc:361:7: note: declared here
 0:38.44 class AnnotateAttr : public InheritableParamAttr {
 0:38.44       ^
 0:38.44 /home/botond/dev/mozilla/central/build/clang-plugin/clang-plugin.cpp:365:41: error: expected expression
 0:38.44         D->specific_attrs<AnnotateAttr>();
 0:38.44                                         ^
 0:38.44 /home/botond/dev/mozilla/central/build/clang-plugin/clang-plugin.cpp:367:31: error: use of undeclared identifier 'Attrs'
 0:38.44     for (AnnotateAttr *Attr : Attrs) {
 0:38.44                               ^
 0:38.44 /home/botond/dev/mozilla/central/build/clang-plugin/clang-plugin.cpp:367:29: error: range-based for loop is a C++11 extension [-Werror,-Wc++11-extensions]
 0:38.44     for (AnnotateAttr *Attr : Attrs) {
 0:38.44                             ^
 0:38.44 /home/botond/dev/mozilla/central/build/clang-plugin/clang-plugin.cpp:486:69: error: a space is required between consecutive right angle brackets (use '> >')
 0:38.44 typedef DenseMap<const CXXRecordDecl *, std::pair<const Decl *, bool>>
 0:38.44                                                                     ^~
 0:38.44                                                                     > >
 0:38.44 /home/botond/dev/mozilla/central/build/clang-plugin/clang-plugin.cpp:500:11: error: 'auto' type specifier is a C++11 extension [-Werror,-Wc++11-extensions]
 0:38.44     const auto &name = method->getName();
 0:38.44           ^
 0:38.44 /home/botond/dev/mozilla/central/build/clang-plugin/clang-plugin.cpp:543:3: error: 'auto' type specifier is a C++11 extension [-Werror,-Wc++11-extensions]
 0:38.44   auto &SourceManager = AC.getSourceManager();
 0:38.44   ^
 0:38.44 /home/botond/dev/mozilla/central/build/clang-plugin/clang-plugin.cpp:544:3: error: 'auto' type specifier is a C++11 extension [-Werror,-Wc++11-extensions]
 0:38.44   auto ExpansionLoc = SourceManager.getExpansionLoc(D.getLocStart());
 0:38.44   ^
 0:38.44 /home/botond/dev/mozilla/central/build/clang-plugin/clang-plugin.cpp:664:3: error: 'auto' type specifier is a C++11 extension [-Werror,-Wc++11-extensions]
 0:38.44   auto &SourceManager = Finder->getASTContext().getSourceManager();
 0:38.44   ^
 0:38.45 fatal error: too many errors emitted, stopping now [-ferror-limit=]
 0:38.45 20 errors generated.
 0:38.45
 0:38.45 In the directory  /home/botond/dev/mozilla/central/objdir-desktop-clang/build/clang-plugin
 0:38.45 The following command failed to execute properly:
 0:38.45 /usr/bin/ccache clang++ -fcolor-diagnostics -o clang-plugin.o -c -DAB_CD=en-US -DNO_NSPR_10_SUPPORT -I/home/botond/dev/mozilla/central/build/clang-plugin -I. -I../../dist/include -I/home/botond/dev/mozilla/central/objdir-desktop-clang/dist/include/nspr -I/home/botond/dev/mozilla/central/objdir-desktop-clang/dist/include/nss -fPIC -Qunused-arguments -Qunused-arguments -I/usr/lib/llvm-3.4/include -DNDEBUG -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -g -O2 -fomit-frame-pointer -fvisibility-inlines-hidden -fno-exceptions -fPIC -Woverloaded-virtual -Wcast-qual -fno-rtti -fno-exceptions -fno-omit-frame-pointer -Werror /home/botond/dev/mozilla/central/build/clang-plugin/clang-plugin.cpp
 0:38.45 make[5]: *** [clang-plugin.o] Error 1
 0:38.45 make[4]: *** [build/clang-plugin/target] Error 2
 0:38.45 make[3]: *** [export] Error 2
 0:38.45 make[2]: *** [default] Error 2
 0:38.45 make[1]: *** [realbuild] Error 2
 0:38.45 make: *** [build] Error 2
 0:38.46 0 compiler warnings present.
 0:39.48 ccache (direct) hit rate: 58.6%; (preprocessed) hit rate: 41.4%; miss rate: 0.0%
(Reporter)

Comment 1

3 years ago
Upgraded clang to 3.6, get the same error.
(Reporter)

Comment 2

2 years ago
The problem was that even though I upgraded to clang 3.6, my llvm-config binary was pointing to the 3.4 version, and the cxx flags it was providing were the 3.4 flags, which don't include -std=c++11 (which we expect).
(Reporter)

Comment 3

2 years ago
Resolving as invalid, as this was a configuration problem on my side.
Status: NEW → RESOLVED
Last Resolved: 2 years ago
Resolution: --- → INVALID

Updated

2 months ago
Product: Core → Firefox Build System
You need to log in before you can comment on or make changes to this bug.