Porting Protocol Buffer Library to Green Hills Integrity

133 views
Skip to first unread message

Alex Chen

unread,
Feb 7, 2018, 7:32:55 PM2/7/18
to Protocol Buffers
I am trying to port the protocol buffer library to Green Hills Integrity on a PPC platform. When compiling the library, I ran into the following compiler error:

"..\vendor\protobuf\src\google/protobuf/reflection_internal.h", line 306: error #1001: 
          class member designated by a using-declaration must be visible in a
          direct base class
    using RepeatedFieldAccessor::Add;

Below is the code snippet where the error occured in reflection_internal.h:

class RepeatedPtrFieldStringAccessor : public RepeatedPtrFieldWrapper<string> {
  typedef void Field;
  typedef void Value;
  using RepeatedFieldAccessor::Add;

 public:
  RepeatedPtrFieldStringAccessor() {}
};

It seems the statement "using RepeatedFieldAccessor::Add" is trying to access the member function Add() that is two levels higher in the class hierarchy, which is not allowed by the compiler because it is not a direct base class. If my explanation is confusing, I wrote a small snippet of code below that simulates the same problem:

class A
{
public:
    virtual void foo() {}
};

template<typename T>
class B : public A
{
public:
    virtual void foo() {}
};

class C : public B<std::string>
{
    using A::foo;
};

I am to successfully compile the protobuf library using Microsoft Visual Studio and Linux GNUC, but not MULTI Integrity compiler. I consulted with Green Hills and they say that syntax is illegal. They even pointed me to this link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=32039

Does anyone know how to workaround this issue? I rather not have to modify the protobuf library code to fix it.

Thanks,

-Alex

Feng Xiao

unread,
Feb 7, 2018, 7:53:25 PM2/7/18
to Alex Chen, Protocol Buffers
Can you create an issue on our github repo?

--
You received this message because you are subscribed to the Google Groups "Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to protobuf+unsubscribe@googlegroups.com.
To post to this group, send email to prot...@googlegroups.com.
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.

Feng Xiao

unread,
Feb 7, 2018, 8:09:33 PM2/7/18
to Alex Chen, Protocol Buffers
I think moving "using RepeatedFieldAccessor::Add" to the parent class RepeatedPtrFieldWrapper might fix the issue. Could you give it a try? If it works, could you also help make a pull request? I don't have a compiler that can reproduce the error you saw.

Feng Xiao

unread,
Feb 7, 2018, 8:15:57 PM2/7/18
to Alex Chen, Protocol Buffers
On Wed, Feb 7, 2018 at 4:32 PM, Alex Chen <a4c...@gmail.com> wrote:
Reading the thread reminds me how difficult C++ is... Is there any way I can run this MULTI Integrity compiler on my macosx, linux or windows? Or can you ask Green Hills what other compiler can reproduce the same problem?
 

Does anyone know how to workaround this issue? I rather not have to modify the protobuf library code to fix it.

Thanks,

-Alex

--
Reply all
Reply to author
Forward
0 new messages