Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expected Identifier Error with 2.6.1 on Mac OS X 10.10 #549

Closed
dustinwilson opened this issue Jun 28, 2015 · 3 comments
Closed

Expected Identifier Error with 2.6.1 on Mac OS X 10.10 #549

dustinwilson opened this issue Jun 28, 2015 · 3 comments

Comments

@dustinwilson
Copy link

I get this error when compiling Spectrum XMPP Transports:

In file included from /usr/local/include/google/protobuf/message.h:120:

/usr/local/include/google/protobuf/descriptor.h:358:5: error: expected identifier

    TYPE_BOOL           = 8,   // bool, varint on the wire.

    ^

/usr/include/ConditionalMacros.h:147:39: note: expanded from macro 'TYPE_BOOL'

     #define TYPE_BOOL

It's an error that's caused because TYPE_BOOL is already defined in ConditionalMacros.h on OS X. In the 3.0.x alphas you've fixed this already by adding:

// TYPE_BOOL is defined in the MacOS's ConditionalMacros.h.
#ifdef TYPE_BOOL
#undef TYPE_BOOL
#endif  // TYPE_BOOL

However in 2.6.x it hasn't been applied there. I'd rather not use alpha software on a production machine. I've patched my local header file, and it fixes the compilation issue. Could you add it to 2.6.x as well while we wait for 3.0 to mature?

@xfxyjwf
Copy link
Contributor

xfxyjwf commented Jun 29, 2015

For 2.6.x, we probably will not make new releases.

The version number has been alpha because we have some more languages to support. If you are using C++/Java/Python, they are mature enough and can be relied on. Internally in Google they are already used on production machines before changes are merged to this github repo.

@dustinwilson
Copy link
Author

Okay. Thanks! I'll just use the latest alpha then.

@yijiem
Copy link

yijiem commented May 1, 2018

While this issue is fixed now, a similar situation happens when I tried to extend FieldOptions in my proto file. Basically, I import https://github.com/google/protobuf/blob/master/src/google/protobuf/descriptor.proto in my.proto file. Then, after compile, my.pb.h includes the pre-compiled https://github.com/google/protobuf/blob/master/src/google/protobuf/descriptor.pb.h which does not have the undef TYPE_BOOL fix in https://github.com/google/protobuf/blob/master/src/google/protobuf/descriptor.h. So I ended up with the same compilation error.

mellery451 referenced this issue in scottschurr/rippled May 9, 2018
taoso pushed a commit to taoso/protobuf that referenced this issue Aug 1, 2018
(*Generator).DefaultPackageName returns either a qualified ("pkg.name") or
unqualified ("name") name.

Prior to commit 9d4962b, it based this decision on whether the
name was in the package we're generating code for.  After this
commit, it bases this on whether the name is in the file we're
currently generating code for. i.e., what was once an invariant
across all files is no longer.

This is mostly fine, except for one case: We run the generator
across files we do not generate code for, in order to build a list
of symbols used to generate code for public imports. This change
caused some of those symbols to no longer be qualified.

In particular, this causes bad generation for wrapper types of
publicly imported messages that contain a field whose type is
another message in the same publicly imported package.

Fix this. Clean up some effectively dead code in SetPackageNames
at the same time. Fix tests to catch this case. (It wouldn't have
caught it anyway, but imp.proto is supposed to contain a public import.
This seems to have been lost when exporting code to git. Fixed.)
rinarakaki pushed a commit to rinarakaki/protobuf that referenced this issue Aug 30, 2023
(NFC) Refactored upbc header generation into smaller methods.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants