linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/10] compiler.h: refactor __is_constexpr() into is_const{,_true,_false}()
@ 2024-12-02 17:33 Vincent Mailhol via B4 Relay
  2024-12-02 17:33 ` [PATCH 01/10] compiler.h: add statically_false() Vincent Mailhol via B4 Relay
                   ` (10 more replies)
  0 siblings, 11 replies; 80+ messages in thread
From: Vincent Mailhol via B4 Relay @ 2024-12-02 17:33 UTC (permalink / raw)
  To: Linus Torvalds, David Laight, Luc Van Oostenryck,
	Nathan Chancellor, Nick Desaulniers, Bill Wendling, Justin Stitt,
	Yury Norov, Rasmus Villemoes, Kees Cook, Gustavo A. R. Silva,
	Jani Nikula, Joonas Lahtinen, Rodrigo Vivi, Tvrtko Ursulin,
	David Airlie, Simona Vetter, Suzuki K Poulose, Mike Leach,
	James Clark, Alexander Shishkin, Rikard Falkeborn, Martin Uecker
  Cc: linux-sparse, linux-kernel, llvm, linux-hardening, intel-gfx,
	dri-devel, coresight, linux-arm-kernel, Vincent Mailhol

This series is the spiritual successor of [1] which introduced
const_true(). In [1], following a comment from David Laight, Linus
came with a suggestion to simplify __is_constexpr() and its derived
macros using a _Generic() selection. Because of the total change of
scope, I am starting a new series.

The goal is to introduce a set of three macros:

  - is_const(): a one to one replacement of __is_constexpr() in term
    of features but written in a less hacky way thanks to _Generic().

  - is_const_true(): tells whether or not the argument is a true
    integer constant expression.

  - is_const_false(): tells whether or not the argument is a false
    integer constant expression.

Once defined, apply them tree-wide.

All those three macros will rely on a single building block:
__is_const_zero().

Patch 1 adds statically_false(). This is just done so that at the end
of this series, the full set of statically_true/false() and
is_const_true/false() is present.

Patch 2 adds __is_const_zero() and is_const().

Patch 3 adds is_const_true() and is_const_false().

Patch 4 to 9 do a tree-wide replacement to remove all the usages of
__is_constexpr() and replace them by is_const_true() or
is_const_false() whenever feasible, or by is_const() otherwise.

Patch 10 finally remove __is_constexpr(). RIP!

[1] add const_true() to simplify GENMASK_INPUT_CHECK()
Link: https://lore.kernel.org/all/20241113172939.747686-4-mailhol.vincent@wanadoo.fr/

Signed-off-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
---
Vincent Mailhol (10):
      compiler.h: add statically_false()
      compiler.h: add is_const() as a replacement of __is_constexpr()
      compiler.h: add is_const_true() and is_const_false()
      linux/bits.h: simplify GENMASK_INPUT_CHECK() by using is_const_true()
      minmax: simplify __clamp_once() by using is_const_false()
      fortify: replace __is_constexpr() by is_const() in strlen()
      overflow: replace __is_constexpr() by is_const()
      drm/i915/reg: replace __is_const_expr() by is_const_true() or is_const()
      coresight: etm4x: replace __is_const_expr() by is_const()
      compiler.h: remove __is_constexpr()

 drivers/gpu/drm/i915/i915_reg_defs.h          |  47 +++++------
 drivers/hwtracing/coresight/coresight-etm4x.h |   2 +-
 include/linux/bits.h                          |   5 +-
 include/linux/compiler.h                      | 112 +++++++++++++++-----------
 include/linux/fortify-string.h                |   4 +-
 include/linux/minmax.h                        |   3 +-
 include/linux/overflow.h                      |   8 +-
 7 files changed, 97 insertions(+), 84 deletions(-)
---
base-commit: e70140ba0d2b1a30467d4af6bcfe761327b9ec95
change-id: 20241129-is_constexpr-refactor-19460adedc48

Best regards,
-- 
Vincent Mailhol <mailhol.vincent@wanadoo.fr>




^ permalink raw reply	[flat|nested] 80+ messages in thread

end of thread, other threads:[~2024-12-09 12:44 UTC | newest]

Thread overview: 80+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-02 17:33 [PATCH 00/10] compiler.h: refactor __is_constexpr() into is_const{,_true,_false}() Vincent Mailhol via B4 Relay
2024-12-02 17:33 ` [PATCH 01/10] compiler.h: add statically_false() Vincent Mailhol via B4 Relay
2024-12-04 18:30   ` David Laight
2024-12-05 15:25     ` Vincent Mailhol
2024-12-06  3:39       ` David Laight
2024-12-06  4:42         ` Vincent Mailhol
2024-12-02 17:33 ` [PATCH 02/10] compiler.h: add is_const() as a replacement of __is_constexpr() Vincent Mailhol via B4 Relay
2024-12-04 18:39   ` David Laight
2024-12-04 21:20     ` Yury Norov
2024-12-05 15:31     ` Vincent Mailhol
2024-12-06  2:25       ` David Laight
2024-12-06  6:14         ` Linus Torvalds
2024-12-06  7:19           ` Vincent Mailhol
2024-12-06  8:49             ` Vincent Mailhol
2024-12-06  8:29           ` Martin Uecker
2024-12-06 18:30           ` Vincent Mailhol
2024-12-06 18:52             ` Linus Torvalds
2024-12-06 19:02               ` Linus Torvalds
2024-12-06 19:06               ` David Laight
2024-12-06 19:15                 ` Linus Torvalds
2024-12-06 19:38                   ` Willy Tarreau
2024-12-06 19:43                     ` David Laight
2024-12-06 19:38                   ` David Laight
2024-12-06 20:23                     ` David Laight
2024-12-07  7:42                       ` Vincent Mailhol
2024-12-07 11:19                         ` David Laight
2024-12-07 12:24                           ` Vincent Mailhol
2024-12-07 18:19                             ` Linus Torvalds
2024-12-07 19:51                               ` Martin Uecker
2024-12-07 20:31                                 ` Linus Torvalds
2024-12-07 20:54                                   ` David Laight
2024-12-07 21:00                                 ` David Laight
2024-12-07 21:06                                   ` Martin Uecker
2024-12-07 21:45                                     ` David Laight
2024-12-09  9:59                               ` Rasmus Villemoes
2024-12-06  6:40         ` Martin Uecker
2024-12-06  7:26           ` Vincent Mailhol
2024-12-07  8:39             ` Martin Uecker
2024-12-07 10:33               ` David Laight
2024-12-07 13:07                 ` Martin Uecker
2024-12-07 18:26                   ` Linus Torvalds
2024-12-07 19:19                     ` Martin Uecker
2024-12-07 20:28                       ` Linus Torvalds
2024-12-07 23:52                         ` Martin Uecker
2024-12-08  1:58                           ` Linus Torvalds
2024-12-08  9:18                             ` Martin Uecker
2024-12-08 11:26                           ` David Laight
2024-12-08 12:38                             ` Martin Uecker
2024-12-08 16:48                               ` David Laight
2024-12-08 18:10                                 ` Martin Uecker
2024-12-08 19:05                                   ` Linus Torvalds
2024-12-07 12:45               ` Vincent Mailhol
2024-12-07 13:18                 ` Martin Uecker
2024-12-07 13:50                   ` Vincent Mailhol
2024-12-07 14:59                     ` Martin Uecker
2024-12-07 15:10                     ` Martin Uecker
2024-12-07 15:23                       ` Vincent Mailhol
2024-12-07 18:07                     ` David Laight
2024-12-06  9:34         ` David Laight
2024-12-02 17:33 ` [PATCH 03/10] compiler.h: add is_const_true() and is_const_false() Vincent Mailhol via B4 Relay
2024-12-04 18:48   ` David Laight
2024-12-05 15:48     ` Vincent Mailhol
2024-12-02 17:33 ` [PATCH 04/10] linux/bits.h: simplify GENMASK_INPUT_CHECK() by using is_const_true() Vincent Mailhol via B4 Relay
2024-12-04 18:52   ` David Laight
2024-12-05 15:49     ` Vincent Mailhol
2024-12-02 17:33 ` [PATCH 05/10] minmax: simplify __clamp_once() by using is_const_false() Vincent Mailhol via B4 Relay
2024-12-04 18:54   ` David Laight
2024-12-05 15:52     ` Vincent Mailhol
2024-12-09 12:32       ` Vincent Mailhol
2024-12-02 17:33 ` [PATCH 06/10] fortify: replace __is_constexpr() by is_const() in strlen() Vincent Mailhol via B4 Relay
2024-12-04 18:58   ` David Laight
2024-12-05 15:53     ` Vincent Mailhol
2024-12-02 17:33 ` [PATCH 07/10] overflow: replace __is_constexpr() by is_const() Vincent Mailhol via B4 Relay
2024-12-02 17:33 ` [PATCH 08/10] drm/i915/reg: replace __is_const_expr() by is_const_true() or is_const() Vincent Mailhol via B4 Relay
2024-12-04 19:00   ` David Laight
2024-12-05 15:56     ` Vincent Mailhol
2024-12-02 17:33 ` [PATCH 09/10] coresight: etm4x: replace __is_const_expr() by is_const() Vincent Mailhol via B4 Relay
2024-12-02 17:33 ` [PATCH 10/10] compiler.h: remove __is_constexpr() Vincent Mailhol via B4 Relay
2024-12-04 23:58 ` [PATCH 00/10] compiler.h: refactor __is_constexpr() into is_const{,_true,_false}() Kees Cook
2024-12-05 15:21   ` Vincent Mailhol

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).