Issue 351 in protobuf: Make protobuf_lite proto files not create any static initializers

45 views
Skip to first unread message

prot...@googlecode.com

unread,
Dec 1, 2011, 9:41:26 PM12/1/11
to prot...@googlegroups.com
Status: New
Owner: liuj...@google.com
Labels: Type-Defect Priority-Medium

New issue 351 by tha...@chromium.org: Make protobuf_lite proto files not
create any static initializers
http://code.google.com/p/protobuf/issues/detail?id=351

We're trying to remove all static initialization from chromium:
http://crbug.com/105626

This is made harder by protoc generating a static initializer for every
protobuf, which is used to create the const reference returned by
default_instance() (we use light protobufs for everything as far as I know,
so we don't use the reflection bits).

We don't call default_instance() in chromium, so it would be nice if we
could get rid of the static initializers somehow.

Have you thought about this, or any suggestions we might go about this? I'm
willing to work on protoc to make this happen.

prot...@googlecode.com

unread,
Dec 1, 2011, 9:45:28 PM12/1/11
to prot...@googlegroups.com
Issue 351: Make protobuf_lite proto files not create any static initializers
http://code.google.com/p/protobuf/issues/detail?id=351

This issue is now blocking issue chromium:105626.
See http://code.google.com/p/chromium/issues/detail?id=105626

--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings

prot...@googlecode.com

unread,
Jan 16, 2012, 4:03:36 PM1/16/12
to prot...@googlegroups.com

Comment #2 on issue 351 by tha...@chromium.org: Make protobuf_lite proto
files not create any static initializers
http://code.google.com/p/protobuf/issues/detail?id=351

I asked a google-internal mailing list (
https://groups.google.com/a/google.com/group/protobuf-discuss/browse_thread/thread/a4a3ceb5d6e396a8
), and the suggestion was to try to use GoogleOnceInit (already in
protobuf:
http://code.google.com/p/protobuf/source/browse/trunk/src/google/protobuf/stubs/once.h
).

prot...@googlecode.com

unread,
Feb 6, 2012, 1:00:06 PM2/6/12
to prot...@googlegroups.com

Comment #4 on issue 351 by ev...@chromium.org: Make protobuf_lite proto
files not create any static initializers
http://code.google.com/p/protobuf/issues/detail?id=351

It looks like on the Windows code path once.h still calls the
ProtobufOnceType() ctor as a static initializer.

prot...@googlecode.com

unread,
Feb 6, 2012, 1:40:32 PM2/6/12
to prot...@googlegroups.com

Comment #5 on issue 351 by tha...@chromium.org: Make protobuf_lite proto
files not create any static initializers
http://code.google.com/p/protobuf/issues/detail?id=351

Blind :-/ Where?

prot...@googlecode.com

unread,
Feb 6, 2012, 2:13:44 PM2/6/12
to prot...@googlegroups.com

Comment #6 on issue 351 by ev...@chromium.org: Make protobuf_lite proto
files not create any static initializers
http://code.google.com/p/protobuf/issues/detail?id=351

http://code.google.com/p/protobuf/source/browse/trunk/src/google/protobuf/stubs/once.h

#define GOOGLE_PROTOBUF_DECLARE_ONCE(NAME) \
::google::protobuf::ProtobufOnceType NAME

and

struct LIBPROTOBUF_EXPORT ProtobufOnceType {
ProtobufOnceType();

prot...@googlecode.com

unread,
Feb 8, 2012, 5:57:50 PM2/8/12
to prot...@googlegroups.com

Comment #7 on issue 351 by pli...@google.com: Make protobuf_lite proto
files not create any static initializers
http://code.google.com/p/protobuf/issues/detail?id=351

I am taking over this issue. Here is a first CL:
https://codereview.appspot.com/5643065/

prot...@googlecode.com

unread,
Mar 2, 2012, 1:30:46 PM3/2/12
to prot...@googlegroups.com
Updates:
Owner: pli...@google.com

Comment #8 on issue 351 by liuj...@google.com: Make protobuf_lite proto

files not create any static initializers
http://code.google.com/p/protobuf/issues/detail?id=351

(No comment was entered for this change.)

prot...@googlecode.com

unread,
May 31, 2012, 3:24:49 PM5/31/12
to prot...@googlegroups.com

Comment #9 on issue 351 by tha...@chromium.org: Make protobuf_lite proto
files not create any static initializers
http://code.google.com/p/protobuf/issues/detail?id=351

Fixed, right?

prot...@googlecode.com

unread,
Jun 1, 2012, 3:49:25 AM6/1/12
to prot...@googlegroups.com
Updates:
Status: Fixed

Comment #10 on issue 351 by pli...@google.com: Make protobuf_lite proto
files not create any static initializers
http://code.google.com/p/protobuf/issues/detail?id=351

Yes, finally :)

Reply all
Reply to author
Forward
0 new messages