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

c_glib: Generated code tries to convert between function and void pointers

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 0.9.3
    • Fix Version/s: 0.9.3
    • Component/s: C glib - Compiler
    • Labels:
    • Environment:

      Fedora 22 (gcc 5.1.1) on x86_64

    • Patch Info:
      Patch Available
    • Flags:
      Patch

      Description

      In code generated by the compiler for C (GLib), a service's processor class incorrectly treats function and void pointers as interchangeable: When adding to the process_map hash table it supplies a pointer to a function, while g_hash_table_insert expects a gpointer (effectively void *) to a data object.

      ISO C explicitly forbids this conversion as it is not compatible with all architectures, and with its -pedantic option enabled gcc will generate warnings like

      gen-c_glib/calculator.c: In function 'calculator_processor_init':
      gen-c_glib/calculator.c:1231:24: warning: ISO C forbids passing argument 3 of 'g_hash_table_insert' between function pointer and 'void *' [-Wpedantic]
                              calculator_processor_process_ping);
      

      The compiler needs to be fixed so the code it generates does not try to use function pointers where data (void) pointers are expected.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                simonsouth Simon South
                Reporter:
                simonsouth Simon South
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: