Commit a8aa7975 by Greg McGary Committed by Greg McGary

flags.h (flag_bounds_check, [...]): New extern decls.

* flags.h (flag_bounds_check, flag_bounded_pointers): New extern decls.
* toplev.c (flag_bounds_check, flag_bounded_pointers): New flags.
(f_options): Add "bounded-pointers" and "bounds-check" entries.
* c-lang.c (lang_init_options): Set flag_bounds_check as "unspecified".
(lang_init): Set default for flag_bounds_check if still "unspecified".

From-SVN: r30035
parent a9d3cc3f
Fri Oct 15 15:17:29 1999 Greg McGary <gkm@gnu.org>
* flags.h (flag_bounds_check, flag_bounded_pointers): New extern decls.
* toplev.c (flag_bounds_check, flag_bounded_pointers): New flags.
(f_options): Add "bounded-pointers" and "bounds-check" entries.
* c-lang.c (lang_init_options): Set flag_bounds_check as "unspecified".
(lang_init): Set default for flag_bounds_check if still "unspecified".
Sat Oct 16 13:42:29 1999 Michael Hayes <m.hayes@elec.canterbury.ac.nz>
* config/c4x/c4x.md (HF mode patterns): Add missing modes.
......
/* Language-specific hook definitions for C front end.
Copyright (C) 1991, 1995, 1997, 1998 Free Software Foundation, Inc.
Copyright (C) 1991, 1995, 1997, 1998, 1999 Free Software Foundation, Inc.
This file is part of GNU CC.
......@@ -28,6 +28,7 @@ Boston, MA 02111-1307, USA. */
#include "c-lex.h"
#include "toplev.h"
#include "output.h"
#include "flags.h"
#include "ggc.h"
#if USE_CPPLIB
......@@ -56,11 +57,17 @@ lang_init_options ()
parse_in.opts = &parse_options;
cpp_options_init (&parse_options);
#endif
/* Mark as "unspecified". */
flag_bounds_check = -1;
}
void
lang_init ()
{
/* If still "unspecified", make it match -fbounded-pointers. */
if (flag_bounds_check < 0)
flag_bounds_check = flag_bounded_pointers;
/* the beginning of the file is a new line; check for # */
/* With luck, we discover the real source file's name from that
and put it in input_filename. */
......
......@@ -476,6 +476,21 @@ extern int flag_instrument_function_entry_exit;
/* Perform a peephole pass before sched2. */
extern int flag_peephole2;
/* -fbounded-pointers causes gcc to compile pointers as composite
objects occupying three words: the pointer value, the base address
of the referent object, and the address immediately beyond the end
of the referent object. The base and extent allow us to perform
runtime bounds checking. -fbounded-pointers implies -fcheck-bounds. */
extern int flag_bounded_pointers;
/* -fcheck-bounds causes gcc to generate array bounds checks.
For C, C++: defaults to value of flag_bounded_pointers.
For ObjC: defaults to off.
For Java: defaults to on.
For Fortran: defaults to off.
For CHILL: defaults to off. */
extern int flag_bounds_check;
/* Other basic status info about current function. */
......
......@@ -752,6 +752,21 @@ int flag_no_ident = 0;
/* This will perform a peephole pass before sched2. */
int flag_peephole2 = 0;
/* -fbounded-pointers causes gcc to compile pointers as composite
objects occupying three words: the pointer value, the base address
of the referent object, and the address immediately beyond the end
of the referent object. The base and extent allow us to perform
runtime bounds checking. -fbounded-pointers implies -fcheck-bounds. */
int flag_bounded_pointers = 0;
/* -fcheck-bounds causes gcc to generate array bounds checks.
For C, C++: defaults to value of flag_bounded_pointers.
For ObjC: defaults to off.
For Java: defaults to on.
For Fortran: defaults to off.
For CHILL: defaults to off. */
int flag_bounds_check = 0;
/* Values of the -falign-* flags: how much to align labels in code.
0 means `use default', 1 means `don't align'.
For each variable, there is an _log variant which is the power
......@@ -985,7 +1000,11 @@ lang_independent_options f_options[] =
{ "peephole2", &flag_peephole2, 1,
"Enables an rtl peephole pass run before sched2" },
{"math-errno", &flag_errno_math, 1,
"Set errno after built-in math functions"}
"Set errno after built-in math functions"},
{"bounded-pointers", &flag_bounded_pointers, 1,
"Compile pointers as triples: value, base & end" },
{"bounds-check", &flag_bounds_check, 1,
"Generate code to check bounds before dereferencing pointers and arrays" }
};
#define NUM_ELEM(a) (sizeof (a) / sizeof ((a)[0]))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment