Re: [Maria-developers] 19fbfab084f: Compilation fix
Hi, Aleksey! On Sep 01, Aleksey Midenkov wrote:
revision-id: 19fbfab084f (mariadb-10.6.1-67-g19fbfab084f) parent(s): 8009680fbc3 author: Aleksey Midenkov committer: Aleksey Midenkov timestamp: 2021-08-30 22:02:40 +0300 message:
Compilation fix
diff --git a/sql/sql_table.h b/sql/sql_table.h index 83e88c82f0e..8cb9ebe0445 100644 --- a/sql/sql_table.h +++ b/sql/sql_table.h @@ -20,8 +20,14 @@ #include <my_sys.h> // pthread_mutex_t #include "m_string.h" // LEX_CUSTRING
+inline bool suicide() +{ + DBUG_SUICIDE(); + return false; +} + #define ERROR_INJECT_CRASH(code) \ - (DBUG_IF(code) && (DBUG_SUICIDE(), 0)) + (DBUG_IF(code) && suicide())
What did that change? A compiler didn't like (void,0) ? Regards, Sergei VP of MariaDB Server Engineering and security@mariadb.org
Hi Sergei! On Wed, Sep 1, 2021 at 3:46 PM Sergei Golubchik <serg@mariadb.org> wrote:
Hi, Aleksey!
On Sep 01, Aleksey Midenkov wrote:
revision-id: 19fbfab084f (mariadb-10.6.1-67-g19fbfab084f) parent(s): 8009680fbc3 author: Aleksey Midenkov committer: Aleksey Midenkov timestamp: 2021-08-30 22:02:40 +0300 message:
Compilation fix
diff --git a/sql/sql_table.h b/sql/sql_table.h index 83e88c82f0e..8cb9ebe0445 100644 --- a/sql/sql_table.h +++ b/sql/sql_table.h @@ -20,8 +20,14 @@ #include <my_sys.h> // pthread_mutex_t #include "m_string.h" // LEX_CUSTRING
+inline bool suicide() +{ + DBUG_SUICIDE(); + return false; +} + #define ERROR_INJECT_CRASH(code) \ - (DBUG_IF(code) && (DBUG_SUICIDE(), 0)) + (DBUG_IF(code) && suicide())
What did that change? A compiler didn't like (void,0) ?
Here #define DBUG_SUICIDE() do { } while(0) DBUG_SUICIDE is not an expression. It's a statement and cannot be used in expression.
Regards, Sergei VP of MariaDB Server Engineering and security@mariadb.org
-- All the best, Aleksey Midenkov @midenok
Hi, Aleksey! On Sep 01, Aleksey Midenkov wrote:
On Wed, Sep 1, 2021 at 3:46 PM Sergei Golubchik <serg@mariadb.org> wrote:
Here
#define DBUG_SUICIDE() do { } while(0)
DBUG_SUICIDE is not an expression. It's a statement and cannot be used in expression.
But that's a bug. Every DBUG_xxx macro is defined at least twice, for dbug and non-dbug builds. All definitions must be either expressions or statements, it cannot arbitrary switch from a statement to an expression or vice versa. In debug builds it's defined as #define DBUG_SUICIDE() (_db_flush_(), _db_suicide_()) so it must be defined as an expression in non-dbug builds too. Regards, Sergei VP of MariaDB Server Engineering and security@mariadb.org
participants (2)
-
Aleksey Midenkov
-
Sergei Golubchik