Bug #94243 WL#9508 introduced non-idiomatic potentially-broken C macros
Submitted: 7 Feb 2019 14:43 Modified: 25 Feb 2019 23:00
Reporter: Laurynas Biveinis (OCA) Email Updates:
Status: Closed Impact on me:
Category:MySQL Server: InnoDB storage engine Severity:S3 (Non-critical)
Version:8.0.14 OS:Any
Assigned to: CPU Architecture:Any

[7 Feb 2019 14:43] Laurynas Biveinis
WL#9508 (CREATE/ALTER/DROP UNDO TABLESPACE) introduced such C macros in fsp0types.h:

/** Set ENCRYPTION bit in tablespace flags */
/** Set ENCRYPTION bit in tablespace flags */

/** Set SDI Index bit in tablespace flags */
#define FSP_FLAGS_SET_SDI(flags) \
  { flags |= FSP_FLAGS_MASK_SDI; }
/** Set SDI Index bit in tablespace flags */
#define FSP_FLAGS_UNSET_SDI(flags) \
  { flags &= ~FSP_FLAGS_MASK_SDI; }

They expand to compound statements, which fail if used in e.g if (foo) FSP_BLAH(); else ...

How to repeat:
Code reading

Suggested fix:
do { ... } while (0) idiom, or, being C++, inline function with reference arg?
[7 Feb 2019 15:44] MySQL Verification Team
Hi Laurynas,

Thank you very much for your improvement suggestion. 

I was in dilemma whether it is a feature request or a bug, but concluded that you are actually correct.

Verified as reported. Thank you !!!!
[25 Feb 2019 23:00] Daniel Price
Posted by developer:
Fixed as of the upcoming 8.0.16 release, and here's the changelog entry:

Problematic macros introduced with undo tablespace DDL support in MySQL
8.0.14 were revised.