Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-34112

Operator name keywords like `and`, `or`, `xor` cause build errors when building with GCC flag `-fno-operator-names`

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Minor
    • Resolution: Unresolved
    • 11.1(EOL), 11.2, 11.4, 11.0(EOL), 11.3(EOL), 11.5(EOL)
    • 11.2, 11.4
    • None
    • None

    Description

      Alternative operator name keywords like `and`, `or`, `xor`, etc., are uncommon in MariaDB and can cause obscure build errors when the GCC flag `-fno-operator-names` is applied.

      Description of `-fno-operator-names` https://gcc.gnu.org/onlinedocs/gcc/C_002b_002b-Dialect-Options.html:

      Do not treat the operator name keywords `and`, `bitand`, `bitor`, `compl`, `not`, `or` and `xor` as synonyms as keywords.

      In 11.0 this line of code was introduced in commit https://github.com/MariaDB/server/commit/b66cdbd1.

      `DBUG_ASSERT(sel >= 0.0 and sel <= 1.00001); `

      The build errors are as following, only the first line is pointing to the problematic line. Other errors are all misleading.

      /local/p4clients/pkgbuild-LdLa_/workspace/src/RDSMariaDB/sql/sql_select.cc
       
      In file included from /local/p4clients/pkgbuild-LdLa_/workspace/src/RDSMariaDB/sql/mariadb.h:29,
                       from /local/p4clients/pkgbuild-LdLa_/workspace/src/RDSMariaDB/sql/sql_select.cc:32:
       
      /local/p4clients/pkgbuild-LdLa_/workspace/src/RDSMariaDB/sql/sql_select.cc: In function 'double table_after_join_selectivity(JOIN*, uint, JOIN_TAB*, table_map, double*)':
       
      /local/p4clients/pkgbuild-LdLa_/workspace/src/RDSMariaDB/sql/sql_select.cc:11171:28: error: expected ')' before 'and'
      11171 |     DBUG_ASSERT(sel >= 0.0 and sel <= 1.00001);
            |                            ^~~
       
      /local/p4clients/pkgbuild-LdLa_/workspace/src/RDSMariaDB/include/my_global.h:372:44: note: in definition of macro 'unlikely'
        372 | #define unlikely(x)     __builtin_expect(((x) != 0),0)
            |                                            ^
       
      /local/p4clients/pkgbuild-LdLa_/workspace/src/RDSMariaDB/sql/sql_select.cc:11171:5: note: in expansion of macro 'DBUG_ASSERT'
      11171 |     DBUG_ASSERT(sel >= 0.0 and sel <= 1.00001);
            |     ^~~~~~~~~~~
       
      /local/p4clients/pkgbuild-LdLa_/workspace/src/RDSMariaDB/include/my_dbug.h:123:17: note: to match this '('
        123 |   if (unlikely(!(A)) && _db_my_assert(__FILE__, __LINE__, #A)) assert(A); \
            |                 ^
       
      /local/p4clients/pkgbuild-LdLa_/workspace/src/RDSMariaDB/include/my_global.h:372:44: note: in definition of macro 'unlikely'
        372 | #define unlikely(x)     __builtin_expect(((x) != 0),0)
            |                                            ^
       
      /local/p4clients/pkgbuild-LdLa_/workspace/src/RDSMariaDB/sql/sql_select.cc:11171:5: note: in expansion of macro 'DBUG_ASSERT'
      11171 |     DBUG_ASSERT(sel >= 0.0 and sel <= 1.00001);
            |     ^~~~~~~~~~~
       
      In file included from /local/p4clients/pkgbuild-LdLa_/workspace/src/RDSMariaDB/include/my_global.h:1039:
       
      /local/p4clients/pkgbuild-LdLa_/workspace/src/RDSMariaDB/include/my_dbug.h:123:73: error: expected ')' before ';' token
        123 |   if (unlikely(!(A)) && _db_my_assert(__FILE__, __LINE__, #A)) assert(A); \
            |                                                                         ^
       
      /local/p4clients/pkgbuild-LdLa_/workspace/src/RDSMariaDB/sql/sql_select.cc:11171:5: note: in expansion of macro 'DBUG_ASSERT'
      11171 |     DBUG_ASSERT(sel >= 0.0 and sel <= 1.00001);
            |     ^~~~~~~~~~~
       
      /local/p4clients/pkgbuild-LdLa_/workspace/src/RDSMariaDB/include/my_global.h:372:43: note: to match this '('
        372 | #define unlikely(x)     __builtin_expect(((x) != 0),0)
            |                                           ^
       
      /local/p4clients/pkgbuild-LdLa_/workspace/src/RDSMariaDB/include/my_dbug.h:123:7: note: in expansion of macro 'unlikely'
        123 |   if (unlikely(!(A)) && _db_my_assert(__FILE__, __LINE__, #A)) assert(A); \
            |       ^~~~~~~~
       
      /local/p4clients/pkgbuild-LdLa_/workspace/src/RDSMariaDB/sql/sql_select.cc:11171:5: note: in expansion of macro 'DBUG_ASSERT'
      11171 |     DBUG_ASSERT(sel >= 0.0 and sel <= 1.00001);
            |     ^~~~~~~~~~~
       
      /local/p4clients/pkgbuild-LdLa_/workspace/src/RDSMariaDB/include/my_dbug.h:123:73: error: expected ')' before ';' token
        123 |   if (unlikely(!(A)) && _db_my_assert(__FILE__, __LINE__, #A)) assert(A); \
            |                                                                         ^
       
      /local/p4clients/pkgbuild-LdLa_/workspace/src/RDSMariaDB/sql/sql_select.cc:11171:5: note: in expansion of macro 'DBUG_ASSERT'
      11171 |     DBUG_ASSERT(sel >= 0.0 and sel <= 1.00001);
            |     ^~~~~~~~~~~
       
      /local/p4clients/pkgbuild-LdLa_/workspace/src/RDSMariaDB/include/my_global.h:372:42: note: to match this '('
        372 | #define unlikely(x)     __builtin_expect(((x) != 0),0)
            |                                          ^
       
      /local/p4clients/pkgbuild-LdLa_/workspace/src/RDSMariaDB/include/my_dbug.h:123:7: note: in expansion of macro 'unlikely'
        123 |   if (unlikely(!(A)) && _db_my_assert(__FILE__, __LINE__, #A)) assert(A); \
            |       ^~~~~~~~
       
      /local/p4clients/pkgbuild-LdLa_/workspace/src/RDSMariaDB/sql/sql_select.cc:11171:5: note: in expansion of macro 'DBUG_ASSERT'
      11171 |     DBUG_ASSERT(sel >= 0.0 and sel <= 1.00001);
            |     ^~~~~~~~~~~
       
      /local/p4clients/pkgbuild-LdLa_/workspace/src/RDSMariaDB/include/my_dbug.h:123:73: error: expected ')' before ';' token
        123 |   if (unlikely(!(A)) && _db_my_assert(__FILE__, __LINE__, #A)) assert(A); \
            |                                                                         ^
       
      /local/p4clients/pkgbuild-LdLa_/workspace/src/RDSMariaDB/sql/sql_select.cc:11171:5: note: in expansion of macro 'DBUG_ASSERT'
      11171 |     DBUG_ASSERT(sel >= 0.0 and sel <= 1.00001);
            |     ^~~~~~~~~~~
       
      /local/p4clients/pkgbuild-LdLa_/workspace/src/RDSMariaDB/include/my_global.h:372:41: note: to match this '('
        372 | #define unlikely(x)     __builtin_expect(((x) != 0),0)
            |                                         ^
       
      /local/p4clients/pkgbuild-LdLa_/workspace/src/RDSMariaDB/include/my_dbug.h:123:7: note: in expansion of macro 'unlikely'
        123 |   if (unlikely(!(A)) && _db_my_assert(__FILE__,
      

      Attachments

        Activity

          People

            TheLinuxJedi Andrew Hutchings
            wenhug Hugo Wen
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.