Skip to content

Avoid -Wdeclaration-after-statement warnings from static_assert

Alan Coopersmith requested to merge alanc/libice:misc into master

Some implementations of static_assert() define a new variable. Avoid warnings from those when calling static_assert() from a macro that may not be at the top of a new code block.

../../src/accept.c: In function 'IceAcceptConnection':
../../src/accept.c:159:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
  159 |     IceGetHeader (iceConn, 0, ICE_ByteOrder,
      |     ^~~~~~~~~~~~
../../src/connect.c: In function 'IceOpenConnection':
../../src/connect.c:254:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
  254 |     IceGetHeader (iceConn, 0, ICE_ByteOrder,
      |     ^~~~~~~~~~~~
../../src/connect.c:340:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
  340 |     IceGetHeaderExtra (iceConn, 0, ICE_ConnectionSetup,
      |     ^~~~~~~~~~~~~~~~~
[...etc...]

Merge request reports