Uploaded image for project: 'Thrift'
  1. Thrift
  2. THRIFT-2676

Cocoa code generator emits reserved symbol, 'i386'

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 0.9.2
    • Cocoa - Compiler
    • None
    • Xcode 5 (iOS)
      Xcode 6 (iOS)

    Description

      The Cocoa code generator has a bug where it can generate a local variable that conflicts with a symbol defined in the iOS SDK. Specifically, it happens when the temporary variable counter reaches the value `386` when emitting an index variable for a for-loop in `t_cocoa_generator::generate_serialize_container()`. The offending symbol is `i386` which apparently is #define'd to equal `1` somewhere in the iOS toolchain.

      This test code demonstrates the problem, regardless of Thrift codegen.

          int i386 = 42;
          printf("foobar %d\n", i386);
      

      Which results in the following compiler error:

      /Users/keith/Desktop/ReservedSymbolTest/ReservedSymbolTest/ViewController.m:22:7: error: expected identifier or '('
        int i386 = 42;
            ^
      <built-in>:143:14: note: expanded from here
                   ^
      1 error generated.
      

      Attachments

        Activity

          People

            roger Roger Meier
            klazuka Keith Lazuka
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: