[v5,0/6] use static_assert for build error reports

Message ID 20240118165315.63959-1-stephen@networkplumber.org (mailing list archive)
Headers
Series use static_assert for build error reports |

Message

Stephen Hemminger Jan. 18, 2024, 4:50 p.m. UTC
  This series fixes a couple places where expressions that could not
be evaluated as constant early in compiler passes were used.
Then converts RTE_BUILD_BUG_ON() with static_assert.

static_assert() is more picky about the expression has to
be a constant, which also catches some existing undefined
behavior that pre-existed.

The series requires a couple of workarounds to deal
with quirks in static_assert() in some toolchains.

v6 - minor cleanups
     handle missing macro in old FreeBSD

Stephen Hemminger (6):
  eal: introduce RTE_MIN_T() and RTE_MAX_T() macros
  event/opdl: fix non-constant compile time assertion
  net/sfc: fix non-constant expression in RTE_BUILD_BUG_ON()
  net/i40e: avoid using const variable in assertion
  mempool: avoid floating point expression in static assertion
  eal: replace out of bounds VLA with static_assert

 drivers/event/opdl/opdl_ring.c       |  2 +-
 drivers/net/i40e/i40e_ethdev.h       |  1 +
 drivers/net/i40e/i40e_rxtx_vec_sse.c | 10 ++++------
 drivers/net/mlx5/mlx5_rxq.c          |  2 +-
 drivers/net/sfc/sfc_ef100_tx.c       |  3 +--
 lib/eal/include/rte_common.h         | 27 ++++++++++++++++++++++++++-
 lib/mempool/rte_mempool.c            |  7 ++++---
 7 files changed, 38 insertions(+), 14 deletions(-)