ZooKeeper
  1. ZooKeeper
  2. ZOOKEEPER-1463

external inline function is not compatible with C99

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Duplicate
    • Affects Version/s: 3.4.3, 3.3.5
    • Fix Version/s: 3.4.4, 3.5.0
    • Component/s: build
    • Labels:
    • Environment:

      debian linux x64

      Description

      There is a use of external inline function in zookeeper hashtable_itr.h file, which is not compatible with C99. This causes problem when compiling with other library like code coverage library.

      hashtable_itr.h:37: error: 'cov_v_cab2c78b' is static but used in inline
      function 'hashtable_iterator_key' which is not static

      The easy fix would be put the following line in hashtable_itr.c which ignores this inline warning.
      #pragma GCC diagnostic ignored "-Winline"

        Activity

        Michael Hu created issue -
        Michael Hu made changes -
        Field Original Value New Value
        Affects Version/s 3.3.5 [ 12319081 ]
        Description There is a use of external inline function, which is not in standard in C99, in zookeeper hashtable_itr.h file. This causes problem when compiling with other library like code coverage library.
        ---
        hashtable_itr.h:37: error: 'cov_v_cab2c78b' is static but used in inline
        function 'hashtable_iterator_key' which is not static
        ---

        The easy fix would be put the following line in hashtable_itr.c which is to ignore this non-standard function.
        #pragma GCC diagnostic ignored "-Winline"
        There is a use of external inline function in zookeeper hashtable_itr.h file, which is not compatible with C99. This causes problem when compiling with other library like code coverage library.
        ---
        hashtable_itr.h:37: error: 'cov_v_cab2c78b' is static but used in inline
        function 'hashtable_iterator_key' which is not static
        ---

        The easy fix would be put the following line in hashtable_itr.c which ignores this inline warning.
        #pragma GCC diagnostic ignored "-Winline"
        Hide
        Michi Mutsuzaki added a comment -

        Hi Michael,

        Would you like to submit a patch for this?

        Thanks!
        --Michi

        Show
        Michi Mutsuzaki added a comment - Hi Michael, Would you like to submit a patch for this? Thanks! --Michi
        Hide
        Michi Mutsuzaki added a comment -

        By the way, we recently changed extern inline to static inline (ZOOKEEPER-1339). Will this still be an issue?

        --Michi

        Show
        Michi Mutsuzaki added a comment - By the way, we recently changed extern inline to static inline ( ZOOKEEPER-1339 ). Will this still be an issue? --Michi
        Michael Hu made changes -
        Attachment zookeeper-1463.patch [ 12525968 ]
        Hide
        Michael Hu added a comment -

        Complete fix for both 1463 and 1339.

        Show
        Michael Hu added a comment - Complete fix for both 1463 and 1339.
        Michael Hu made changes -
        Attachment zookeeper-1463_1339.patch [ 12525970 ]
        Hide
        Michael Hu added a comment -

        Thanks Michi. I have attached patches. Also the fix to change external inline to static inline could be a better solution as long as we delete same definition in hashtable_itr.c, otherwise we get these

        src/c/src/hashtable/hashtable_itr.c:45: error: redefinition of 'hashtable_iterator_key'
        src/c/src/hashtable/hashtable_itr.h:36: note: previous definition of 'hashtable_iterator_key' was here
        src/c/src/hashtable/hashtable_itr.c:49: error: redefinition of 'hashtable_iterator_value'
        src/c/src/hashtable/hashtable_itr.h:45: note: previous definition of 'hashtable_iterator_value' was here

        Show
        Michael Hu added a comment - Thanks Michi. I have attached patches. Also the fix to change external inline to static inline could be a better solution as long as we delete same definition in hashtable_itr.c, otherwise we get these — src/c/src/hashtable/hashtable_itr.c:45: error: redefinition of 'hashtable_iterator_key' src/c/src/hashtable/hashtable_itr.h:36: note: previous definition of 'hashtable_iterator_key' was here src/c/src/hashtable/hashtable_itr.c:49: error: redefinition of 'hashtable_iterator_value' src/c/src/hashtable/hashtable_itr.h:45: note: previous definition of 'hashtable_iterator_value' was here —
        Patrick Hunt made changes -
        Assignee Michael Hu [ pwp ]
        Hide
        Patrick Hunt added a comment -

        Thanks Michael. Could you attach at a single patch? Otherwise the automated testing won't pick it up. Attach as a single patch including all the changes, then click "submit patch" button above.

        Show
        Patrick Hunt added a comment - Thanks Michael. Could you attach at a single patch? Otherwise the automated testing won't pick it up. Attach as a single patch including all the changes, then click "submit patch" button above.
        Patrick Hunt made changes -
        Fix Version/s 3.4.4 [ 12319841 ]
        Fix Version/s 3.5.0 [ 12316644 ]
        Michael Hu made changes -
        Attachment zookeeper-1463.patch [ 12525968 ]
        Hide
        Michael Hu added a comment -

        Done. Thanks.

        Show
        Michael Hu added a comment - Done. Thanks.
        Michael Hu made changes -
        Status Open [ 1 ] Patch Available [ 10002 ]
        Hide
        Hadoop QA added a comment -

        -1 overall. Here are the results of testing the latest attachment
        http://issues.apache.org/jira/secure/attachment/12525970/zookeeper-1463_1339.patch
        against trunk revision 1336467.

        +1 @author. The patch does not contain any @author tags.

        -1 tests included. The patch doesn't appear to include any new or modified tests.
        Please justify why no new tests are needed for this patch.
        Also please list what manual steps were performed to verify this patch.

        -1 patch. The patch command could not apply the patch.

        Console output: https://builds.apache.org/job/PreCommit-ZOOKEEPER-Build/1067//console

        This message is automatically generated.

        Show
        Hadoop QA added a comment - -1 overall. Here are the results of testing the latest attachment http://issues.apache.org/jira/secure/attachment/12525970/zookeeper-1463_1339.patch against trunk revision 1336467. +1 @author. The patch does not contain any @author tags. -1 tests included. The patch doesn't appear to include any new or modified tests. Please justify why no new tests are needed for this patch. Also please list what manual steps were performed to verify this patch. -1 patch. The patch command could not apply the patch. Console output: https://builds.apache.org/job/PreCommit-ZOOKEEPER-Build/1067//console This message is automatically generated.
        Hide
        Patrick Hunt added a comment -

        Looks like the patch is failing to apply against trunk. Is the code different btw 3.4 branch and trunk? If so you might need to provide two patches (if so attach the br3.4 first, then attach trunk, the patch tester only looks for the most recent patch file attached).

        Show
        Patrick Hunt added a comment - Looks like the patch is failing to apply against trunk. Is the code different btw 3.4 branch and trunk? If so you might need to provide two patches (if so attach the br3.4 first, then attach trunk, the patch tester only looks for the most recent patch file attached).
        Patrick Hunt made changes -
        Status Patch Available [ 10002 ] Open [ 1 ]
        Hide
        Michi Mutsuzaki added a comment -

        This is a duplicate of ZOOKEEPER-1339, which has been applied to 3.3/3.4/trunk.

        --Michi

        Show
        Michi Mutsuzaki added a comment - This is a duplicate of ZOOKEEPER-1339 , which has been applied to 3.3/3.4/trunk. --Michi
        Michi Mutsuzaki made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Duplicate [ 3 ]

          People

          • Assignee:
            Michael Hu
            Reporter:
            Michael Hu
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Time Tracking

              Estimated:
              Original Estimate - 0.1h
              0.1h
              Remaining:
              Remaining Estimate - 0.1h
              0.1h
              Logged:
              Time Spent - Not Specified
              Not Specified

                Development