linux-sparse.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 00/13] improve constexpr handling
@ 2016-01-25 14:47 Nicolai Stange
  2016-01-25 14:49 ` [PATCH v2 01/13] expression: introduce additional expression constness tracking flags Nicolai Stange
                   ` (13 more replies)
  0 siblings, 14 replies; 43+ messages in thread
From: Nicolai Stange @ 2016-01-25 14:47 UTC (permalink / raw)
  To: linux-sparse
  Cc: Christopher Li, Josh Triplett, Luc Van Oostenryck, Nicolai Stange

This is the second attempt to clean up and improve sparse's handling
of constant expressions. After I got some helpful reviews from
Josh Triplett and Luc Van Oostenryck on my initial RFC series, I feel
quite comfortable with this now and dropped the 'RFC' tag in favour of
'v2'.

Quote from my initial 'RFC' cover letter regarding the structure of
this series:

  This patch series is split into four parts:
  - The first part deals with the refactorization of the current integer
    constant expression handling and introduces some support for
    recognizing arithmetic expressions. [1-5/13]
  - The second part introduces support for recognizing address constants.
    [6/13]
  - The third part introduces a check for the constness of static storage
    duration objects' initializers. [7/13]
  - The last part stems from my tests with the kernel. It contains things
    I missed in the first [9-10/13] and second [8,12/13] parts and
    relaxes some of the constraints on constant expressions [11/13].
    For the last patch [13/13], please see below. 
  [...]
  Although the patches of the fourth part, the fixup part, fit very well
  into the first two categories, their associated testcases, if any,
  depend on [7/13]. Thus, I dediced to keep the order as is.

Quote end.


The question from the initial 'RFC' series whether or not to relax the
constexpr constraints, meaning that

  a difference of address constants may yield an integer constant

in order to make the kernel's ACPI_OFFSET macro happy, is still
unaddressed. However, if it turns out that we actually want to do so,
this single issue can be easily handled by some follow up patch.


Changes made between v2 and the initial, 'RFC' tagged series:
 - As suggested by Josh Triplett,
   [7/13] ("check static storage duration objects' intializers' constness")
   only warns now if -Wstatic-initializer-not-const is given.
   This option is not enabled by default and thus, the two testsuite
   failers reported by Luc Van Oostenryck cease to fail.
 - Luc Van Oostenryck didn't like the way the setting and clearing of
   flags is handled. I did not completely follow his advice of
   introducing predefined sets of masks to or in/and out resp., because
   setting and clearing is kind of different. However, I tried to
   address his concerns by changing expr_{set,clear}_flag_mask(...)
   into expr_{set,clear}_flag(...) whose interfaces are (hopefully) much
   saner.


Nicolai Stange (13):
  expression: introduce additional expression constness tracking flags
  expression: examine constness of casts at evaluation only
  expression: examine constness of binops and alike at evaluation only
  expression: examine constness of preops at evaluation only
  expression: examine constness of conditionals at evaluation only
  expression, evaluate: add support for recognizing address constants
  evaluate: check static storage duration objects' intializers'
    constness
  expression: recognize references to labels as address constants
  expression: examine constness of __builtin_offsetof at evaluation only
  symbol: flag builtins constant_p, safe_p and warning as constexprs
  evaluate: relax some constant expression rules for pointer expressions
  expression, evaluate: support compound literals as address constants
  symbol: do not inherit storage modifiers from base types at
    examination

 evaluate.c                              | 188 ++++++++++++++++++++++++--------
 expand.c                                |   2 +-
 expression.c                            |  52 ++++-----
 expression.h                            | 123 ++++++++++++++++++++-
 lib.c                                   |   2 +
 lib.h                                   |   2 +-
 sparse.1                                |   7 ++
 symbol.c                                |  12 +-
 validation/constexpr-binop.c            |  33 ++++++
 validation/constexpr-cast.c             |  25 +++++
 validation/constexpr-compound-literal.c |  19 ++++
 validation/constexpr-conditional.c      |  34 ++++++
 validation/constexpr-init.c             | 110 +++++++++++++++++++
 validation/constexpr-offsetof.c         |  21 ++++
 validation/constexpr-preop.c            |  29 +++++
 15 files changed, 575 insertions(+), 84 deletions(-)
 create mode 100644 validation/constexpr-binop.c
 create mode 100644 validation/constexpr-cast.c
 create mode 100644 validation/constexpr-compound-literal.c
 create mode 100644 validation/constexpr-conditional.c
 create mode 100644 validation/constexpr-init.c
 create mode 100644 validation/constexpr-offsetof.c
 create mode 100644 validation/constexpr-preop.c

-- 
2.7.0


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

end of thread, other threads:[~2016-02-01  3:06 UTC | newest]

Thread overview: 43+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-25 14:47 [PATCH v2 00/13] improve constexpr handling Nicolai Stange
2016-01-25 14:49 ` [PATCH v2 01/13] expression: introduce additional expression constness tracking flags Nicolai Stange
2016-01-25 21:51   ` Luc Van Oostenryck
2016-01-26 15:26     ` Nicolai Stange
2016-01-26 15:37       ` Nicolai Stange
2016-01-25 14:51 ` [PATCH v2 02/13] expression: examine constness of casts at evaluation only Nicolai Stange
2016-01-25 22:02   ` Luc Van Oostenryck
2016-01-26 16:11     ` Nicolai Stange
2016-01-25 14:52 ` [PATCH v2 03/13] expression: examine constness of binops and alike " Nicolai Stange
2016-01-26  0:14   ` Luc Van Oostenryck
2016-01-26 15:50     ` Nicolai Stange
2016-01-26 17:24       ` Luc Van Oostenryck
2016-01-27 10:42         ` Nicolai Stange
2016-01-27 18:00           ` Luc Van Oostenryck
2016-01-26  0:59   ` Luc Van Oostenryck
2016-01-25 14:53 ` [PATCH v2 04/13] expression: examine constness of preops " Nicolai Stange
2016-01-26  1:10   ` Luc Van Oostenryck
2016-01-25 14:55 ` [PATCH v2 05/13] expression: examine constness of conditionals " Nicolai Stange
2016-01-26  1:16   ` Luc Van Oostenryck
2016-01-25 14:56 ` [PATCH v2 06/13] expression, evaluate: add support for recognizing address constants Nicolai Stange
2016-01-26  1:27   ` Luc Van Oostenryck
2016-01-26  3:10   ` Luc Van Oostenryck
2016-01-25 14:57 ` [PATCH v2 07/13] evaluate: check static storage duration objects' intializers' constness Nicolai Stange
2016-01-26  1:42   ` Luc Van Oostenryck
2016-01-26 16:08     ` Nicolai Stange
2016-01-26 17:56       ` Luc Van Oostenryck
2016-01-26 20:18         ` Luc Van Oostenryck
2016-02-01  3:00     ` Nicolai Stange
2016-01-25 14:59 ` [PATCH v2 08/13] expression: recognize references to labels as address constants Nicolai Stange
2016-01-26  1:45   ` Luc Van Oostenryck
2016-01-25 15:00 ` [PATCH v2 09/13] expression: examine constness of __builtin_offsetof at evaluation only Nicolai Stange
2016-01-26  1:57   ` Luc Van Oostenryck
2016-02-01  3:06     ` Nicolai Stange
2016-01-25 15:02 ` [PATCH v2 10/13] symbol: flag builtins constant_p, safe_p and warning as constexprs Nicolai Stange
2016-01-26  2:00   ` Luc Van Oostenryck
2016-01-25 15:03 ` [PATCH v2 11/13] evaluate: relax some constant expression rules for pointer expressions Nicolai Stange
2016-01-26  2:05   ` Luc Van Oostenryck
2016-01-25 15:04 ` [PATCH v2 12/13] expression, evaluate: support compound literals as address constants Nicolai Stange
2016-01-26  2:07   ` Luc Van Oostenryck
2016-01-25 15:05 ` [PATCH v2 13/13] symbol: do not inherit storage modifiers from base types at examination Nicolai Stange
2016-01-26  2:54   ` Luc Van Oostenryck
2016-01-25 21:01 ` [PATCH v2 00/13] improve constexpr handling Luc Van Oostenryck
2016-01-25 21:26   ` Nicolai Stange

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).