diff mbox

document IntegerRange in internals manual

Message ID de2dba86-f024-97cb-8270-cc3e34d5d9af@gmail.com
State New
Headers show

Commit Message

Martin Sebor July 7, 2017, 7:20 p.m. UTC
A conflict in my patch for bug 81345 made me notice that r249734
recently added a new option property, IntegerRange.  The change
below adds brief documentation of the property to the manual.

Martin, can you please check to make sure I didn't miss anything?

Btw., while experimenting with the property I noticed that there
is no error when option that specifies IntegerRange is set in
the .opt file to a value outside that range.  Would it be hard
to add some checks the the awk scripts to validate that the
argument values are in the range?  It might help avoid bugs
similar to 81345).

By the way of an example, the following invalid specification
is accepted but then causes errors when GCC runs.

Wfoobar
C ObjC C++ ObjC++ Warning Alias(Wfoobar=, 1, 0)

Wfoobar=
C ObjC C++ ObjC++ Joined RejectNegative UInteger Var(warn_foobar) 
Warning LangEnabledBy(C ObjC C++ ObjC++, Wall, 2, 0) Init (7) 
IntegerRange(3, 5)

Martin

  putting it in canonical form, and before comparing with the strings
diff mbox

Patch

diff --git a/gcc/doc/options.texi b/gcc/doc/options.texi
index 3b68aab..af56e9f 100644
--- a/gcc/doc/options.texi
+++ b/gcc/doc/options.texi
@@ -264,6 +264,12 @@  option handler.  @code{UInteger} should also be 
used on options like
  @code{-falign-loops}=@var{n} are supported to make sure the saved
  options are given a full integer.

+@item IntegerRange(@var{min}, @var{max})
+The option's integer argument is expected to be in the range specified
+by @var{min} and @var{max}, inclusive.  The option parser will check
+and reject option arguments that are outside the range before passing
+it to the relevant option handler.
+
  @item ToLower
  The option's argument should be converted to lowercase as part of