Skip to content

Commit 8275756

Browse files
committed
ObjC: Add stdin/stdout/stderr to reserved word list.
This will cause fields named exactly these names to get `_p` appended to them. This is being done since the C89/C99/etc specs say these name should be macros, so in an ObjC context, trying to access the fields would result in runtime failures for unknown selectors. The only way the fields were usable was to use KVC or via the descriptor based apis, but if someone hit that they likely would have reported the general issue also.
1 parent d2f6d9b commit 8275756

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/google/protobuf/compiler/objectivec/objectivec_helpers.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,10 @@ const char* const kReservedWordList[] = {
213213
// Not a keyword, but will break you
214214
"NULL",
215215

216+
// C88+ specs call for these to be macros, so depending on what they are
217+
// defined to be it can lead to odd errors for some Xcode/SDK versions.
218+
"stdin", "stdout", "stderr",
219+
216220
// Objective-C Runtime typedefs
217221
// From <obc/runtime.h>
218222
"Category", "Ivar", "Method", "Protocol",

0 commit comments

Comments
 (0)