Issue 419 in protobuf: enumerators have comma on last value

51 views
Skip to first unread message

prot...@googlecode.com

unread,
Sep 14, 2012, 10:41:32 AM9/14/12
to prot...@googlegroups.com
Status: New
Owner: liuj...@google.com
Labels: Type-Defect Priority-Medium

New issue 419 by mattycla...@gmail.com: enumerators have comma on last value
http://code.google.com/p/protobuf/issues/detail?id=419

What steps will reproduce the problem?
1. build with g++-4.6.3 --std=c++ -pedantic -pedantic-errors
2. See errors about commas at end of enumerators

What is the expected output? What do you see instead?
In file included from
google/protobuf/2.4.1/vendor/install/include/google/protobuf/wire_format_lite_inl.h:43:0,
from protobuf/inc/message.pb.cc:10:
google/protobuf/2.4.1/vendor/install/include/google/protobuf/wire_format_lite.h:94:34:
error:
comma at end of enumerator list [-pedantic]
google/protobuf/2.4.1/vendor/install/include/google/protobuf/wire_format_lite.h:117:29:
error:
comma at end of enumerator list [-pedantic]
google/protobuf/2.4.1/vendor/install/include/google/protobuf/wire_format_lite.h:132:29:
error:
comma at end of enumerator list [-pedantic]
In file included from protobuf/inc/message.pb.cc:11:0:
google/protobuf/2.4.1/vendor/install/include/google/protobuf/descriptor.h:322:29:
error:
comma at end of enumerator list [-pedantic]
google/protobuf/2.4.1/vendor/install/include/google/protobuf/descriptor.h:341:29:
error:
comma at end of enumerator list [-pedantic]
google/protobuf/2.4.1/vendor/install/include/google/protobuf/descriptor.h:352:28:
error:
comma at end of enumerator list [-pedantic]
In file included from protobuf/inc/message.pb.cc:13:0:
google/protobuf/2.4.1/vendor/install/include/google/protobuf/wire_format.h:226:14:
error:
comma at end of enumerator list [-pedantic]

What version of the product are you using? On what operating system?
2.4.1
Ubuntu 12.04
g++-4.6.3

Please provide any additional information below.

Probably a generation problem - just need to not generate the comma on the
end of the last enumeration?

prot...@googlecode.com

unread,
Dec 3, 2012, 6:15:51 PM12/3/12
to prot...@googlegroups.com
Updates:
Status: WorkingAsIntended

Comment #1 on issue 419 by xiaof...@google.com: enumerators have comma on
last value
http://code.google.com/p/protobuf/issues/detail?id=419

This isn't an error. The trailing comma is allowed by the C++ standard.

prot...@googlecode.com

unread,
Feb 10, 2013, 4:58:37 PM2/10/13
to prot...@googlegroups.com

Comment #2 on issue 419 by leehar...@gmail.com: enumerators have comma on
last value
http://code.google.com/p/protobuf/issues/detail?id=419

The trailing comma at the end of an enumerator list was added in the C++11
standard. It is not in the C++03 standard. Is protobuf designed to only
work with C++11?

From "7.2 Enumeration declarations" in ISO/IEC 14882:2003(E) (C++03):

enum-name:
identifier

enum-specifier:
"enum" identifier(opt) "{" enumerator-list(opt) "}"

enumerator-list:
enumerator-definition
enumerator-list "," enumerator-definition

enumerator-definition:
enumerator
enumerator "=" constant-expression

enumerator:
identifier


prot...@googlecode.com

unread,
Feb 18, 2013, 3:24:05 AM2/18/13
to prot...@googlegroups.com

Comment #3 on issue 419 by xiaof...@google.com: enumerators have comma on
last value
http://code.google.com/p/protobuf/issues/detail?id=419

Ah, I wasn't aware that it's not allowed in C++03 standard. Of course
protobuf is not designed to only work with C++11, but I doubt that major
compilers will not support this trailing comma feature.

--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings
Reply all
Reply to author
Forward
0 new messages