This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
PATCH (volatile support)
- To: egcs at cygnus dot com
- Subject: PATCH (volatile support)
- From: mrs at wrs dot com (Mike Stump)
- Date: Mon, 4 May 1998 14:34:23 -0700
Here's one that adds volatile use support to the compiler. This is
necessary because ANSI C says that one must mark variables that expect
to have the right values across setjmp/longjmp must be marked as
volatile, as I recall.
tree.h almost seemed like the exact wrong place for this code, but
nothing struct me as the right place for it. Maybe someone with a
better sense of the big picture can recommend a better place for it.
There are only two other places I know of that have this same exact
problem. In the C lexer and in the C++ lexer. I wanted to think
about the performace impact on those two before changing them.
1998-05-01 Mike Stump <mrs@kankakee.wrs.com>
* tree.h: Add support for using volatile in the compiler.
* tree.c (build_real_from_int_cst): Use volatile to protect
values across setmp/longjmp.
* fold-const.c (const_binop): Likewise.
(fold_convert): Likewise.
Doing diffs in tree.h.~1~:
*** tree.h.~1~ Fri Apr 17 16:15:43 1998
--- tree.h Fri May 1 17:58:52 1998
*************** extern void dwarf2out_begin_prologue PRO
*** 2221,2223 ****
--- 2221,2227 ----
code for a function definition. */
extern void dwarf2out_end_epilogue PROTO((void));
+
+ #ifndef __STDC__
+ #define volatile
+ #endif
--------------
Doing diffs in fold-const.c.~1~:
*** fold-const.c.~1~ Mon Apr 27 13:17:46 1998
--- fold-const.c Fri May 1 17:40:23 1998
*************** int_const_binop (code, arg1, arg2, notru
*** 1255,1261 ****
static tree
const_binop (code, arg1, arg2, notrunc)
enum tree_code code;
! register tree arg1, arg2;
int notrunc;
{
STRIP_NOPS (arg1); STRIP_NOPS (arg2);
--- 1255,1261 ----
static tree
const_binop (code, arg1, arg2, notrunc)
enum tree_code code;
! volatile tree arg1, arg2;
int notrunc;
{
STRIP_NOPS (arg1); STRIP_NOPS (arg2);
*************** const_binop (code, arg1, arg2, notrunc)
*** 1268,1274 ****
{
REAL_VALUE_TYPE d1;
REAL_VALUE_TYPE d2;
! int overflow = 0;
REAL_VALUE_TYPE value;
tree t;
--- 1268,1274 ----
{
REAL_VALUE_TYPE d1;
REAL_VALUE_TYPE d2;
! volatile int overflow = 0;
REAL_VALUE_TYPE value;
tree t;
*************** fold_convert (t, arg1)
*** 1497,1503 ****
register tree arg1;
{
register tree type = TREE_TYPE (t);
! int overflow = 0;
if (POINTER_TYPE_P (type) || INTEGRAL_TYPE_P (type))
{
--- 1497,1503 ----
register tree arg1;
{
register tree type = TREE_TYPE (t);
! volatile int overflow = 0;
if (POINTER_TYPE_P (type) || INTEGRAL_TYPE_P (type))
{
--------------
Doing diffs in tree.c.~1~:
*** tree.c.~1~ Thu Apr 16 12:00:10 1998
--- tree.c Fri May 1 17:29:35 1998
*************** build_real_from_int_cst (type, i)
*** 1458,1464 ****
tree i;
{
tree v;
! int overflow = TREE_OVERFLOW (i);
REAL_VALUE_TYPE d;
jmp_buf float_error;
--- 1458,1464 ----
tree i;
{
tree v;
! volatile int overflow = TREE_OVERFLOW (i);
REAL_VALUE_TYPE d;
jmp_buf float_error;
--------------