From 4d9fa86309ff2561efeb6c1b4c5f2b946d7f498b Mon Sep 17 00:00:00 2001 From: borislav nikolov Date: Wed, 17 Feb 2016 12:08:33 +0100 Subject: make it compile with gcc < 4.5.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit $ make Q= googlepb g++ -O3 -std=c++98 -pedantic -Wno-long-long -Wall -Wextra -Wpointer-arith -Wno-unused-private-field -I. -DNDEBUG -c -o obj/upb/bindings/googlepb/bridge.o upb/bindings/googlepb/bridge.cc In file included from ./upb/handlers.h:22, from ./upb/bindings/googlepb/bridge.h:42, from upb/bindings/googlepb/bridge.cc:8: ./upb/def.h: In constructor ‘upb::Pointer::Pointer(upb::Def*)’: ./upb/def.h:39: error: class ‘upb::Pointer’ does not have any field named ‘PointerBase’ ./upb/def.h:39: error: no matching function for call to ‘upb::PointerBase::PointerBase()’ ./upb/upb.h:246: note: candidates are: upb::PointerBase::PointerBase(T*) [with T = upb::Def, Base = upb::RefCounted] ./upb/upb.h:244: note: upb::PointerBase::PointerBase(const upb::PointerBase&) ... the generated code looks like: template <> class Pointer : public PointerBase { public: explicit Pointer(upb::Def* ptr) : PointerBase(ptr) {} }; .. which falls into https://gcc.gnu.org/bugzilla/show_bug.cgi?id=189 (http://stackoverflow.com/questions/8887864/template-base-constructor-call-in-member-initialization-list-error) changing the generated code to: template <> class Pointer : public PointerBase { public: explicit Pointer(upb::Def* ptr) : PointerBase(ptr) {} }; makes it compile at least on 4.4.7 that we are testing with: $ gcc -v Using built-in specs. Target: x86_64-redhat-linux Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre --enable-libgcj-multifile --enable-java-maintainer-mode --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib --with-ppl --with-cloog --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux Thread model: posix gcc version 4.4.7 20120313 (Red Hat 4.4.7-4) (GCC) --- upb/upb.h | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'upb') diff --git a/upb/upb.h b/upb/upb.h index 01d8646..581486d 100644 --- a/upb/upb.h +++ b/upb/upb.h @@ -127,13 +127,15 @@ template <> \ class Pointer : public PointerBase { \ public: \ - explicit Pointer(cppname* ptr) : PointerBase(ptr) {} \ + explicit Pointer(cppname* ptr) : \ + PointerBase(ptr) {} \ }; \ template <> \ class Pointer \ : public PointerBase { \ public: \ - explicit Pointer(const cppname* ptr) : PointerBase(ptr) {} \ + explicit Pointer(const cppname* ptr) : \ + PointerBase(ptr) {} \ }; \ } @@ -145,13 +147,15 @@ template <> \ class Pointer : public PointerBase2 { \ public: \ - explicit Pointer(cppname* ptr) : PointerBase2(ptr) {} \ + explicit Pointer(cppname* ptr) : \ + PointerBase2(ptr) {} \ }; \ template <> \ class Pointer \ : public PointerBase2 { \ public: \ - explicit Pointer(const cppname* ptr) : PointerBase2(ptr) {} \ + explicit Pointer(const cppname* ptr) : \ + PointerBase2(ptr) {} \ }; \ } -- cgit v1.2.3 From 5da90a3571d172f1b4b99267d044642ad6bda25b Mon Sep 17 00:00:00 2001 From: borislav nikolov Date: Thu, 18 Feb 2016 11:06:09 +0100 Subject: indent according to google-style-guide https://google.github.io/styleguide/cppguide.html#Constructor_Initializer_Lists ``` // If the signature and initializer list are not all on one line, // you must wrap before the colon and indent 4 spaces: MyClass::MyClass(int var) : some_var_(var), some_other_var_(var + 1) { DoSomething(); } ``` and ``` // As with any other code block, the close curly can be on the same // line as the open curly, if it fits. MyClass::MyClass(int var) : some_var_(var) {} ``` --- upb/upb.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'upb') diff --git a/upb/upb.h b/upb/upb.h index 581486d..d1107e7 100644 --- a/upb/upb.h +++ b/upb/upb.h @@ -127,15 +127,15 @@ template <> \ class Pointer : public PointerBase { \ public: \ - explicit Pointer(cppname* ptr) : \ - PointerBase(ptr) {} \ + explicit Pointer(cppname* ptr) \ + : PointerBase(ptr) {} \ }; \ template <> \ class Pointer \ : public PointerBase { \ public: \ - explicit Pointer(const cppname* ptr) : \ - PointerBase(ptr) {} \ + explicit Pointer(const cppname* ptr) \ + : PointerBase(ptr) {} \ }; \ } @@ -147,15 +147,15 @@ template <> \ class Pointer : public PointerBase2 { \ public: \ - explicit Pointer(cppname* ptr) : \ - PointerBase2(ptr) {} \ + explicit Pointer(cppname* ptr) \ + : PointerBase2(ptr) {} \ }; \ template <> \ class Pointer \ : public PointerBase2 { \ public: \ - explicit Pointer(const cppname* ptr) : \ - PointerBase2(ptr) {} \ + explicit Pointer(const cppname* ptr) \ + : PointerBase2(ptr) {} \ }; \ } -- cgit v1.2.3