Skip to content

Compile pinba with GCC7 #63

@degtyaryov

Description

@degtyaryov

Hello.

No compile with GCC7.

Build result:

...
ha_pinba.cc: In member function 'int ha_pinba::tag_info_fetch_row(unsigned char*)':
ha_pinba.cc:5425:44: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
  if (!share->params || share->params[0] == '\0') {     \
                                            ^
ha_pinba.cc:5458:2: note: in expansion of macro 'TAG_INFO_FETCH_TOP_BLOCK'
  TAG_INFO_FETCH_TOP_BLOCK(tag_info);
  ^~~~~~~~~~~~~~~~~~~~~~~~
ha_pinba.cc: In member function 'int ha_pinba::tag2_info_fetch_row(unsigned char*)':
ha_pinba.cc:5425:44: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
  if (!share->params || share->params[0] == '\0') {     \
                                            ^
ha_pinba.cc:5517:2: note: in expansion of macro 'TAG_INFO_FETCH_TOP_BLOCK'
  TAG_INFO_FETCH_TOP_BLOCK(tag2_info);
  ^~~~~~~~~~~~~~~~~~~~~~~~
ha_pinba.cc: In member function 'int ha_pinba::tag_report_fetch_row(unsigned char*)':
ha_pinba.cc:5591:44: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
  if (!share->params || share->params[0] == '\0') {        \
                                            ^
ha_pinba.cc:5661:2: note: in expansion of macro 'TAG_REPORT_TOP_BLOCK'
  TAG_REPORT_TOP_BLOCK(tag_report);
  ^~~~~~~~~~~~~~~~~~~~
ha_pinba.cc: In member function 'int ha_pinba::tag2_report_fetch_row(unsigned char*)':
ha_pinba.cc:5591:44: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
  if (!share->params || share->params[0] == '\0') {        \
                                            ^
ha_pinba.cc:5724:2: note: in expansion of macro 'TAG_REPORT_TOP_BLOCK'
  TAG_REPORT_TOP_BLOCK(tag2_report);
  ^~~~~~~~~~~~~~~~~~~~
ha_pinba.cc: In member function 'int ha_pinba::tag_report2_fetch_row(unsigned char*)':
ha_pinba.cc:5591:44: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
  if (!share->params || share->params[0] == '\0') {        \
                                            ^
ha_pinba.cc:5791:2: note: in expansion of macro 'TAG_REPORT_TOP_BLOCK'
  TAG_REPORT_TOP_BLOCK(tag_report2);
  ^~~~~~~~~~~~~~~~~~~~
ha_pinba.cc: In member function 'int ha_pinba::tag2_report2_fetch_row(unsigned char*)':
ha_pinba.cc:5591:44: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
  if (!share->params || share->params[0] == '\0') {        \
                                            ^
ha_pinba.cc:5862:2: note: in expansion of macro 'TAG_REPORT_TOP_BLOCK'
  TAG_REPORT_TOP_BLOCK(tag2_report2);
  ^~~~~~~~~~~~~~~~~~~~
ha_pinba.cc: In member function 'int ha_pinba::tag_report_fetch_row_by_script(unsigned char*, const unsigned char*, uint)':
ha_pinba.cc:5948:44: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
  if (!share->params || share->params[0] == '\0') {        \
                                            ^
ha_pinba.cc:5994:2: note: in expansion of macro 'TAG_REPORT_TOP_BLOCK_BY_SCRIPT'
  TAG_REPORT_TOP_BLOCK_BY_SCRIPT(tag_report);

ha_pinba.cc: In member function 'int ha_pinba::tag2_report_fetch_row_by_script(unsigned char*, const unsigned char*, uint)':
ha_pinba.cc:5948:44: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
  if (!share->params || share->params[0] == '\0') {        \
                                            ^
ha_pinba.cc:6057:2: note: in expansion of macro 'TAG_REPORT_TOP_BLOCK_BY_SCRIPT'
  TAG_REPORT_TOP_BLOCK_BY_SCRIPT(tag2_report);
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ha_pinba.cc: In member function 'int ha_pinba::tag_report2_fetch_row_by_script(unsigned char*, const unsigned char*, uint)':
ha_pinba.cc:5948:44: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
  if (!share->params || share->params[0] == '\0') {        \
                                            ^
ha_pinba.cc:6124:2: note: in expansion of macro 'TAG_REPORT_TOP_BLOCK_BY_SCRIPT'
  TAG_REPORT_TOP_BLOCK_BY_SCRIPT(tag_report2);
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ha_pinba.cc: In member function 'int ha_pinba::tag2_report2_fetch_row_by_script(unsigned char*, const unsigned char*, uint)':
ha_pinba.cc:5948:44: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
  if (!share->params || share->params[0] == '\0') {        \
                                            ^
ha_pinba.cc:6195:2: note: in expansion of macro 'TAG_REPORT_TOP_BLOCK_BY_SCRIPT'
  TAG_REPORT_TOP_BLOCK_BY_SCRIPT(tag2_report2);
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ha_pinba.cc: In member function 'int ha_pinba::tagN_info_fetch_row(unsigned char*)':
ha_pinba.cc:6279:44: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
  if (!share->params || share->params[0] == '\0') {
                                            ^~~~
ha_pinba.cc: In member function 'int ha_pinba::tagN_report_fetch_row(unsigned char*)':
ha_pinba.cc:6373:44: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
  if (!share->params || share->params[0] == '\0') {          \
                                            ^
ha_pinba.cc:6447:2: note: in expansion of macro 'TAGN_REPORT_TOP_BLOCK'
  TAGN_REPORT_TOP_BLOCK(tagN_report);
  ^~~~~~~~~~~~~~~~~~~~~
ha_pinba.cc: In member function 'int ha_pinba::tagN_report2_fetch_row(unsigned char*)':
ha_pinba.cc:6373:44: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
  if (!share->params || share->params[0] == '\0') {          \
                                            ^
ha_pinba.cc:6509:2: note: in expansion of macro 'TAGN_REPORT_TOP_BLOCK'
  TAGN_REPORT_TOP_BLOCK(tagN_report2);
  ^~~~~~~~~~~~~~~~~~~~~
ha_pinba.cc: In member function 'int ha_pinba::tagN_report_fetch_row_by_script(unsigned char*, const unsigned char*, uint)':
ha_pinba.cc:6586:44: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
  if (!share->params || share->params[0] == '\0') {          \
                                            ^
ha_pinba.cc:6640:2: note: in expansion of macro 'TAGN_REPORT_TOP_BLOCK_BY_SCRIPT'
  TAGN_REPORT_TOP_BLOCK_BY_SCRIPT(tagN_report);
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ha_pinba.cc: In member function 'int ha_pinba::tagN_report2_fetch_row_by_script(unsigned char*, const unsigned char*, uint)':
ha_pinba.cc:6586:44: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
  if (!share->params || share->params[0] == '\0') {          \
                                            ^
ha_pinba.cc:6702:2: note: in expansion of macro 'TAGN_REPORT_TOP_BLOCK_BY_SCRIPT'
  TAGN_REPORT_TOP_BLOCK_BY_SCRIPT(tagN_report2);
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ha_pinba.cc: In member function 'int ha_pinba::histogram_fetch_row_by_key(unsigned char*, const unsigned char*, uint)':
ha_pinba.cc:6931:136: warning: field precision specifier '.*' expects argument of type 'int', but argument 4 has type 'long int' [-Wformat=]
    script_len = snprintf((char *)index_script, PINBA_SCRIPT_NAME_SIZE, "%.*s", p - (char *)this_index[0].str.val, this_index[0].str.val);
                                                                                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                       ^
make[2]: *** [Makefile:497: ha_pinba.lo] Error 1
...

To compile the pinba with GCC7, I needed following patch.

--- pinba_engine-1.1.0/src/ha_pinba-orig.cc     2015-02-12 16:24:37.000000000 +0300
+++ pinba_engine-1.1.0/src/ha_pinba.cc  2018-04-05 12:14:21.000000000 +0300
@@ -5422,7 +5422,7 @@ inline int ha_pinba::status_fetch_row(un
                                                                                                                                                \
        DBUG_ENTER("ha_pinba:: ##report_name## _fetch_row");                            \
                                                                                                                                                \
-       if (!share->params || share->params[0] == '\0') {                                       \
+       if (!share->params || *share->params[0] == '\0') {                                      \
                DBUG_RETURN(HA_ERR_INTERNAL_ERROR);                                                             \
        }                                                                                                                                       \
                                                                                                                                                \
@@ -5588,7 +5588,7 @@ inline int ha_pinba::tag2_info_fetch_row
                                                                                                                                                                        \
        DBUG_ENTER("ha_pinba:: ##report_name## _fetch_row");                                                    \
                                                                                                                                                                        \
-       if (!share->params || share->params[0] == '\0') {                                                               \
+       if (!share->params || *share->params[0] == '\0') {                                                              \
                DBUG_RETURN(HA_ERR_INTERNAL_ERROR);                                                                                     \
        }                                                                                                                                                               \
                                                                                                                                                                        \
@@ -5945,7 +5945,7 @@ inline int ha_pinba::tag2_report2_fetch_
                                                                                                                                                                        \
        DBUG_ENTER("ha_pinba:: ##report_name## _fetch_row_by_script");                                  \
                                                                                                                                                                        \
-       if (!share->params || share->params[0] == '\0') {                                                               \
+       if (!share->params || *share->params[0] == '\0') {                                                              \
                DBUG_RETURN(HA_ERR_INTERNAL_ERROR);                                                                                     \
        }                                                                                                                                                               \
                                                                                                                                                                        \
@@ -6276,7 +6276,7 @@ inline int ha_pinba::tagN_info_fetch_row
 
        DBUG_ENTER("ha_pinba::tagN_info_fetch_row");
 
-       if (!share->params || share->params[0] == '\0') {
+       if (!share->params || *share->params[0] == '\0') {
                DBUG_RETURN(HA_ERR_INTERNAL_ERROR);
        }
 
@@ -6370,7 +6370,7 @@ inline int ha_pinba::tagN_info_fetch_row
                                                                                                                                                                                        \
        DBUG_ENTER("ha_pinba:: ##report_name## _fetch_row");                                                                    \
                                                                                                                                                                                        \
-       if (!share->params || share->params[0] == '\0') {                                                                               \
+       if (!share->params || *share->params[0] == '\0') {                                                                              \
                DBUG_RETURN(HA_ERR_INTERNAL_ERROR);                                                                                                     \
        }                                                                                                                                                                               \
                                                                                                                                                                                        \
@@ -6583,7 +6583,7 @@ inline int ha_pinba::tagN_report2_fetch_
                                                                                                                                                                                        \
        DBUG_ENTER("ha_pinba:: ##report_name## _fetch_row_by_script");                                                  \
                                                                                                                                                                                        \
-       if (!share->params || share->params[0] == '\0') {                                                                               \
+       if (!share->params || *share->params[0] == '\0') {                                                                              \
                DBUG_RETURN(HA_ERR_INTERNAL_ERROR);                                                                                                     \
        }                                                                                                                                                                               \
                                                                                                                                                                                        \

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions