bison-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 0/2] RFC: Discourage the use of unbound string literals


From: Akim Demaille
Subject: [PATCH 0/2] RFC: Discourage the use of unbound string literals
Date: Sun, 17 Nov 2019 18:37:01 +0100

String literals as tokens serve two distinct purposes: freeing from
having to implement the keyword matching in the scanner, and improving
error messages.  Most of the time both can be achieved at the same
time, but on occasions, it does not work so well.

We promote their use for error messages, and will still support the
former case, but it is _not_ the recommended approach.

Besides, string literals, because they don't need to be declared, are
somewhat dangerous.  The new option -Wdangling-alias should help
catching them.  I'm unsure about the proper name for this warning.  I
once used "useless-alias", but it's too strong: some people do use the
string aliases in their scanners.  Could also have been
-Wunbound-alias.  I'd be happy to receive suggestions!

Cheers!

        Akim

Akim Demaille (2):
  diagnostics: complain about undeclared string tokens
  doc: don't promote dangling aliases

 NEWS           | 38 +++++++++++++++++++++++++++
 doc/bison.texi | 69 +++++++++++++++++++++++++++++++++++++++++++++++---
 src/complain.c | 18 +++++++------
 src/complain.h |  4 ++-
 src/symtab.c   |  9 ++++++-
 tests/input.at | 25 ++++++++++++++++++
 6 files changed, 149 insertions(+), 14 deletions(-)

-- 
2.24.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]