From 8d9bfdc59dbb0ac947b27c22b8cf12a6e757bc64 Mon Sep 17 00:00:00 2001 From: Richard Kenner Date: Mon, 6 Jul 1992 18:35:53 -0400 Subject: [PATCH] Changes to support execution on 64-bit machines. From-SVN: r1484 --- gcc/c-decl.c | 128 +++++++++++++++++++++++++++---------------------- gcc/c-lex.c | 50 ++++++++++++------- gcc/c-typeck.c | 43 +++++++++-------- gcc/cccp.c | 42 +++++++++++----- 4 files changed, 159 insertions(+), 104 deletions(-) diff --git a/gcc/c-decl.c b/gcc/c-decl.c index 6a9b270f9a7..c9d2815b3af 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -41,9 +41,6 @@ enum decl_context BITFIELD, /* Likewise but with specified width */ TYPENAME}; /* Typename (inside cast or sizeof) */ -#undef NULL -#define NULL 0 - #ifndef CHAR_TYPE_SIZE #define CHAR_TYPE_SIZE BITS_PER_UNIT #endif @@ -864,8 +861,8 @@ poplevel (keep, reverse, functionbody) if (keep || functionbody || (current_binding_level->keep_if_subblocks && subblocks != 0)) - block = build_block (keep ? decls : 0, keep ? tags : 0, - subblocks, 0, 0); + block = build_block (keep ? decls : NULL_TREE, keep ? tags : NULL_TREE, + subblocks, NULL_TREE, NULL_TREE); /* In each subblock, record that this is its superior. */ @@ -1108,7 +1105,7 @@ pushtag (name, type) us a convenient place to record the "scope start" address for the tagged type. */ - TYPE_STUB_DECL (type) = pushdecl (build_decl (TYPE_DECL, NULL, type)); + TYPE_STUB_DECL (type) = pushdecl (build_decl (TYPE_DECL, NULL_TREE, type)); } /* Handle when a new declaration NEWDECL @@ -1974,7 +1971,7 @@ implicitly_declare (functionid) /* This is a no-op in c-lang.c or something real in objc-actions.c. */ maybe_objc_check_decl (decl); - rest_of_decl_compilation (decl, 0, 0, 0); + rest_of_decl_compilation (decl, NULL_PTR, 0, 0); if (warn_implicit && implicit_warning) warning ("implicit declaration of function `%s'", @@ -2509,7 +2506,7 @@ init_decl_processing () endlink = tree_cons (NULL_TREE, void_type_node, NULL_TREE); void_ftype_any - = build_function_type (void_type_node, 0); + = build_function_type (void_type_node, NULL_TREE); double_ftype_double = build_function_type (double_type_node, @@ -2587,21 +2584,21 @@ init_decl_processing () /* ``integer_tpe_node'' misspelling corrected: North-Keys 30 Mar 91 */ builtin_function ("__builtin_constant_p", build_function_type (integer_type_node, endlink), - BUILT_IN_CONSTANT_P, 0); + BUILT_IN_CONSTANT_P, NULL_PTR); builtin_function ("__builtin_return_address", build_function_type (integer_type_node, tree_cons (NULL_TREE, unsigned_type_node, endlink)), - BUILT_IN_RETURN_ADDRESS, 0); + BUILT_IN_RETURN_ADDRESS, NULL_PTR); builtin_function ("__builtin_frame_address", build_function_type (integer_type_node, tree_cons (NULL_TREE, unsigned_type_node, endlink)), - BUILT_IN_FRAME_ADDRESS, 0); + BUILT_IN_FRAME_ADDRESS, NULL_PTR); builtin_function ("__builtin_alloca", build_function_type (ptr_type_node, @@ -2616,22 +2613,25 @@ init_decl_processing () tree_cons (NULL_TREE, sizetype, endlink)), - BUILT_IN_ALLOCA, 0); + BUILT_IN_ALLOCA, NULL_PTR); /* Suppress error if redefined as a non-function. */ DECL_BUILT_IN_NONANSI (temp) = 1; - temp = builtin_function ("_exit", void_ftype_any, NOT_BUILT_IN, 0); + temp = builtin_function ("_exit", void_ftype_any, NOT_BUILT_IN, + NULL_PTR); TREE_THIS_VOLATILE (temp) = 1; TREE_SIDE_EFFECTS (temp) = 1; /* Suppress error if redefined as a non-function. */ DECL_BUILT_IN_NONANSI (temp) = 1; } - builtin_function ("__builtin_abs", int_ftype_int, BUILT_IN_ABS, 0); - builtin_function ("__builtin_fabs", double_ftype_double, BUILT_IN_FABS, 0); - builtin_function ("__builtin_labs", long_ftype_long, BUILT_IN_LABS, 0); - builtin_function ("__builtin_ffs", int_ftype_int, BUILT_IN_FFS, 0); + builtin_function ("__builtin_abs", int_ftype_int, BUILT_IN_ABS, NULL_PTR); + builtin_function ("__builtin_fabs", double_ftype_double, BUILT_IN_FABS, + NULL_PTR); + builtin_function ("__builtin_labs", long_ftype_long, BUILT_IN_LABS, + NULL_PTR); + builtin_function ("__builtin_ffs", int_ftype_int, BUILT_IN_FFS, NULL_PTR); builtin_function ("__builtin_saveregs", default_function_type, - BUILT_IN_SAVEREGS, 0); + BUILT_IN_SAVEREGS, NULL_PTR); /* EXPAND_BUILTIN_VARARGS is obsolete. */ #if 0 builtin_function ("__builtin_varargs", @@ -2639,19 +2639,19 @@ init_decl_processing () tree_cons (NULL_TREE, integer_type_node, endlink)), - BUILT_IN_VARARGS, 0); + BUILT_IN_VARARGS, NULL_PTR); #endif builtin_function ("__builtin_classify_type", default_function_type, - BUILT_IN_CLASSIFY_TYPE, 0); + BUILT_IN_CLASSIFY_TYPE, NULL_PTR); builtin_function ("__builtin_next_arg", build_function_type (ptr_type_node, endlink), - BUILT_IN_NEXT_ARG, 0); + BUILT_IN_NEXT_ARG, NULL_PTR); builtin_function ("__builtin_args_info", build_function_type (integer_type_node, tree_cons (NULL_TREE, integer_type_node, endlink)), - BUILT_IN_ARGS_INFO, 0); + BUILT_IN_ARGS_INFO, NULL_PTR); /* Currently under experimentation. */ builtin_function ("__builtin_memcpy", memcpy_ftype, @@ -2672,24 +2672,28 @@ init_decl_processing () However, honor the -fno-builtin option. */ if (!flag_no_builtin) { - builtin_function ("abs", int_ftype_int, BUILT_IN_ABS, 0); - builtin_function ("fabs", double_ftype_double, BUILT_IN_FABS, 0); - builtin_function ("labs", long_ftype_long, BUILT_IN_LABS, 0); - builtin_function ("memcpy", memcpy_ftype, BUILT_IN_MEMCPY, 0); - builtin_function ("memcmp", int_ftype_cptr_cptr_sizet, BUILT_IN_MEMCMP, 0); - builtin_function ("strcmp", int_ftype_string_string, BUILT_IN_STRCMP, 0); - builtin_function ("strcpy", string_ftype_ptr_ptr, BUILT_IN_STRCPY, 0); - builtin_function ("strlen", strlen_ftype, BUILT_IN_STRLEN, 0); - builtin_function ("sqrt", double_ftype_double, BUILT_IN_FSQRT, 0); + builtin_function ("abs", int_ftype_int, BUILT_IN_ABS, NULL_PTR); + builtin_function ("fabs", double_ftype_double, BUILT_IN_FABS, NULL_PTR); + builtin_function ("labs", long_ftype_long, BUILT_IN_LABS, NULL_PTR); + builtin_function ("memcpy", memcpy_ftype, BUILT_IN_MEMCPY, NULL_PTR); + builtin_function ("memcmp", int_ftype_cptr_cptr_sizet, BUILT_IN_MEMCMP, + NULL_PTR); + builtin_function ("strcmp", int_ftype_string_string, BUILT_IN_STRCMP, + NULL_PTR); + builtin_function ("strcpy", string_ftype_ptr_ptr, BUILT_IN_STRCPY, + NULL_PTR); + builtin_function ("strlen", strlen_ftype, BUILT_IN_STRLEN, NULL_PTR); + builtin_function ("sqrt", double_ftype_double, BUILT_IN_FSQRT, NULL_PTR); /* Declare these functions volatile to avoid spurious "control drops through" warnings. */ /* Don't specify the argument types, to avoid errors from certain code which isn't valid in ANSI but which exists. */ - temp = builtin_function ("abort", void_ftype_any, NOT_BUILT_IN, 0); + temp = builtin_function ("abort", void_ftype_any, NOT_BUILT_IN, + NULL_PTR); TREE_THIS_VOLATILE (temp) = 1; TREE_SIDE_EFFECTS (temp) = 1; - temp = builtin_function ("exit", void_ftype_any, NOT_BUILT_IN, 0); + temp = builtin_function ("exit", void_ftype_any, NOT_BUILT_IN, NULL_PTR); TREE_THIS_VOLATILE (temp) = 1; TREE_SIDE_EFFECTS (temp) = 1; } @@ -2697,15 +2701,22 @@ init_decl_processing () #if 0 /* Support for these has not been written in either expand_builtin or build_function_call. */ - builtin_function ("__builtin_div", default_ftype, BUILT_IN_DIV, 0); - builtin_function ("__builtin_ldiv", default_ftype, BUILT_IN_LDIV, 0); - builtin_function ("__builtin_ffloor", double_ftype_double, BUILT_IN_FFLOOR, 0); - builtin_function ("__builtin_fceil", double_ftype_double, BUILT_IN_FCEIL, 0); - builtin_function ("__builtin_fmod", double_ftype_double_double, BUILT_IN_FMOD, 0); - builtin_function ("__builtin_frem", double_ftype_double_double, BUILT_IN_FREM, 0); - builtin_function ("__builtin_memset", ptr_ftype_ptr_int_int, BUILT_IN_MEMSET, 0); - builtin_function ("__builtin_getexp", double_ftype_double, BUILT_IN_GETEXP, 0); - builtin_function ("__builtin_getman", double_ftype_double, BUILT_IN_GETMAN, 0); + builtin_function ("__builtin_div", default_ftype, BUILT_IN_DIV, NULL_PTR); + builtin_function ("__builtin_ldiv", default_ftype, BUILT_IN_LDIV, NULL_PTR); + builtin_function ("__builtin_ffloor", double_ftype_double, BUILT_IN_FFLOOR, + NULL_PTR); + builtin_function ("__builtin_fceil", double_ftype_double, BUILT_IN_FCEIL, + NULL_PTR); + builtin_function ("__builtin_fmod", double_ftype_double_double, + BUILT_IN_FMOD, NULL_PTR); + builtin_function ("__builtin_frem", double_ftype_double_double, + BUILT_IN_FREM, NULL_PTR); + builtin_function ("__builtin_memset", ptr_ftype_ptr_int_int, + BUILT_IN_MEMSET, NULL_PTR); + builtin_function ("__builtin_getexp", double_ftype_double, BUILT_IN_GETEXP, + NULL_PTR); + builtin_function ("__builtin_getman", double_ftype_double, BUILT_IN_GETMAN, + NULL_PTR); #endif /* Create the global bindings for __FUNCTION__ and __PRETTY_FUNCTION__. */ @@ -2741,7 +2752,7 @@ builtin_function (name, type, function_code, library_name) DECL_BUILT_IN_NONANSI (decl) = 1; if (library_name) DECL_ASSEMBLER_NAME (decl) = get_identifier (library_name); - make_decl_rtl (decl, 0, 1); + make_decl_rtl (decl, NULL_PTR, 1); pushdecl (decl); if (function_code != NOT_BUILT_IN) { @@ -3151,7 +3162,7 @@ finish_decl (decl, init, asmspec_tree) { /* This is a no-op in c-lang.c or something real in objc-actions.c. */ maybe_objc_check_decl (decl); - rest_of_decl_compilation (decl, 0, + rest_of_decl_compilation (decl, NULL_PTR, current_binding_level == global_binding_level, 0); } @@ -3843,7 +3854,9 @@ grokdeclarator (declarator, declspecs, decl_context, initialized) /* Omit the arg types if -traditional, since the arg types and the list links might not be permanent. */ - type = build_function_type (type, flag_traditional ? 0 : arg_types); + type = build_function_type (type, + flag_traditional + ? NULL_TREE : arg_types); #endif type = build_function_type (type, arg_types); declarator = TREE_OPERAND (declarator, 0); @@ -4551,7 +4564,7 @@ grokfield (filename, line, declarator, declspecs, width) value = grokdeclarator (declarator, declspecs, width ? BITFIELD : FIELD, 0); - finish_decl (value, NULL, NULL); + finish_decl (value, NULL_TREE, NULL_TREE); DECL_INITIAL (value) = width; return value; @@ -4674,7 +4687,8 @@ finish_struct (t, fieldlist) error_with_decl (x, "zero width for bit-field `%s'"); DECL_INITIAL (x) = NULL; } - else if (width > TYPE_PRECISION (TREE_TYPE (x))) + else if (width > TYPE_PRECISION (TREE_TYPE (x)) + || TREE_INT_CST_HIGH (DECL_INITIAL (x)) != 0) { DECL_INITIAL (x) = NULL; pedwarn_with_decl (x, "width of `%s' exceeds its type"); @@ -4829,7 +4843,7 @@ finish_struct (t, fieldlist) layout_decl (decl, 0); /* This is a no-op in c-lang.c or something real in objc-actions.c. */ maybe_objc_check_decl (decl); - rest_of_decl_compilation (decl, 0, toplevel, 0); + rest_of_decl_compilation (decl, NULL_PTR, toplevel, 0); if (! toplevel) expand_decl (decl); --current_binding_level->n_incomplete; @@ -4919,8 +4933,8 @@ finish_enum (enumtype, values) { register tree pair; tree minnode = 0, maxnode = 0; - register long maxvalue = 0; - register long minvalue = 0; + register HOST_WIDE_INT maxvalue = 0; + register HOST_WIDE_INT minvalue = 0; register int i; unsigned precision = 0; int toplevel = global_binding_level == current_binding_level; @@ -4956,8 +4970,8 @@ finish_enum (enumtype, values) precision = TYPE_PRECISION (long_long_integer_type_node); else { - int maxvalue = TREE_INT_CST_LOW (maxnode); - int minvalue = TREE_INT_CST_LOW (minnode); + maxvalue = TREE_INT_CST_LOW (maxnode); + minvalue = TREE_INT_CST_LOW (minnode); if (maxvalue > 0) precision = floor_log2 (maxvalue) + 1; @@ -5065,7 +5079,7 @@ build_enumerator (name, value) TREE_TYPE (value) = integer_type_node; pushdecl (decl); - return saveable_tree_cons (decl, value, NULL); + return saveable_tree_cons (decl, value, NULL_TREE); } /* Create the FUNCTION_DECL for a function definition. @@ -5186,7 +5200,8 @@ start_function (declspecs, declarator, nested) if (TREE_CODE (restype) == INTEGER_TYPE && TYPE_PRECISION (restype) < TYPE_PRECISION (integer_type_node)) restype = integer_type_node; - DECL_RESULT (current_function_decl) = build_decl (RESULT_DECL, 0, restype); + DECL_RESULT (current_function_decl) + = build_decl (RESULT_DECL, NULL_TREE, restype); if (!nested) /* Allocate further tree nodes temporarily during compilation @@ -5518,14 +5533,15 @@ store_parm_decls () for (parm = DECL_ARGUMENTS (fndecl); parm; parm = TREE_CHAIN (parm)) { - type = perm_tree_cons (NULL, DECL_ARG_TYPE (parm), NULL); + type = perm_tree_cons (NULL_TREE, DECL_ARG_TYPE (parm), + NULL_TREE); if (last) TREE_CHAIN (last) = type; else actual = type; last = type; } - type = perm_tree_cons (NULL, void_type_node, NULL); + type = perm_tree_cons (NULL_TREE, void_type_node, NULL_TREE); if (last) TREE_CHAIN (last) = type; else diff --git a/gcc/c-lex.c b/gcc/c-lex.c index 0ee33cd709a..e53eb9dfb74 100644 --- a/gcc/c-lex.c +++ b/gcc/c-lex.c @@ -343,8 +343,21 @@ yyprint (file, yychar, yylval) case CONSTANT: t = yylval.ttype; if (TREE_CODE (t) == INTEGER_CST) - fprintf (file, " 0x%8x%8x", TREE_INT_CST_HIGH (t), - TREE_INT_CST_LOW (t)); + fprintf (file, +#if HOST_BITS_PER_WIDE_INT == 64 +#if HOST_BITS_PER_WIDE_INT != HOST_BITS_PER_INT + " 0x%lx%016lx", +#else + " 0x%x%016x", +#endif +#else +#if HOST_BITS_PER_WIDE_INT != HOST_BITS_PER_INT + " 0x%lx%08lx", +#else + " 0x%x%08x", +#endif +#endif + TREE_INT_CST_HIGH (t), TREE_INT_CST_LOW (t)); break; } } @@ -1344,7 +1357,7 @@ yylex () { set_float_handler (handler); value = REAL_VALUE_ATOF (token_buffer); - set_float_handler (0); + set_float_handler (NULL_PTR); } #ifdef ERANGE if (errno == ERANGE && !flag_traditional && pedantic) @@ -1424,6 +1437,7 @@ yylex () else { tree traditional_type, ansi_type, type; + HOST_WIDE_INT high, low; int spec_unsigned = 0; int spec_long = 0; int spec_long_long = 0; @@ -1496,14 +1510,18 @@ yylex () /* This is simplified by the fact that our constant is always positive. */ - /* The casts in the following statement should not be - needed, but they get around bugs in some C compilers. */ - yylval.ttype - = (build_int_2 - ((((long)parts[3]<<24) + ((long)parts[2]<<16) - + ((long)parts[1]<<8) + (long)parts[0]), - (((long)parts[7]<<24) + ((long)parts[6]<<16) - + ((long)parts[5]<<8) + (long)parts[4]))); + + high = low = 0; + + for (i = 0; i < HOST_BITS_PER_WIDE_INT / HOST_BITS_PER_CHAR; i++) + { + high |= ((HOST_WIDE_INT) parts[i + (HOST_BITS_PER_WIDE_INT + / HOST_BITS_PER_CHAR)] + << (i * HOST_BITS_PER_CHAR)); + low |= (HOST_WIDE_INT) parts[i] << (i * HOST_BITS_PER_CHAR); + } + + yylval.ttype = build_int_2 (low, high); /* If warn_traditional, calculate both the ANSI type and the traditional type, then see if they disagree. @@ -1665,13 +1683,13 @@ yylex () if (TREE_UNSIGNED (char_type_node) || ((result >> (num_bits - 1)) & 1) == 0) yylval.ttype - = build_int_2 (result & ((unsigned) ~0 - >> (HOST_BITS_PER_INT - num_bits)), + = build_int_2 (result & ((unsigned HOST_WIDE_INT) ~0 + >> (HOST_BITS_PER_WIDE_INT - num_bits)), 0); else yylval.ttype - = build_int_2 (result | ~((unsigned) ~0 - >> (HOST_BITS_PER_INT - num_bits)), + = build_int_2 (result | ~((unsigned HOST_WIDE_INT) ~0 + >> (HOST_BITS_PER_WIDE_INT - num_bits)), -1); } else @@ -1685,7 +1703,7 @@ yylex () || (num_chars == 1 && token_buffer[1] != '\0')) { wchar_t wc; - (void) mbtowc (NULL, NULL, 0); + (void) mbtowc (NULL_PTR, NULL_PTR, 0); if (mbtowc (& wc, token_buffer + 1, num_chars) == num_chars) result = wc; else diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c index 4d551f94546..95f7c4970d1 100644 --- a/gcc/c-typeck.c +++ b/gcc/c-typeck.c @@ -287,7 +287,7 @@ common_type (t1, t2) newargs = 0; for (i = 0; i < len; i++) - newargs = tree_cons (0, 0, newargs); + newargs = tree_cons (NULL_TREE, NULL_TREE, newargs); n = newargs; @@ -1011,7 +1011,7 @@ build_component_ref (datum, component) { if (TYPE_SIZE (type) == 0) { - incomplete_type_error (0, type); + incomplete_type_error (NULL_TREE, type); return error_mark_node; } @@ -2027,7 +2027,7 @@ convert_arguments (typelist, values, name) parmval = default_conversion (parmval); #endif } - result = tree_cons (0, parmval, result); + result = tree_cons (NULL_TREE, parmval, result); } else if (TREE_CODE (TREE_TYPE (val)) == REAL_TYPE && (TYPE_PRECISION (TREE_TYPE (val)) @@ -3676,7 +3676,7 @@ build_c_cast (type, expr) name = ""; return digest_init (type, build_nt (CONSTRUCTOR, NULL_TREE, build_tree_list (field, value)), - 0, 0, 0, name); + NULL_PTR, 0, 0, name); } error ("cast to union type from type not present in union"); return error_mark_node; @@ -4200,7 +4200,7 @@ store_init_value (decl, init) /* Digest the specified initializer into an expression. */ - value = digest_init (type, init, 0, TREE_STATIC (decl), + value = digest_init (type, init, NULL_PTR, TREE_STATIC (decl), TREE_STATIC (decl) || pedantic, IDENTIFIER_POINTER (DECL_NAME (decl))); @@ -4667,13 +4667,13 @@ digest_init (type, init, tail, require_constant, constructor_constant, ofwhat) } if (raw_constructor) - result = process_init_constructor (type, inside_init, 0, + result = process_init_constructor (type, inside_init, NULL_PTR, require_constant, constructor_constant, ofwhat); else if (tail != 0) { *tail = old_tail_contents; - result = process_init_constructor (type, 0, tail, + result = process_init_constructor (type, NULL_TREE, tail, require_constant, constructor_constant, ofwhat); } @@ -4751,20 +4751,23 @@ digest_init (type, init, tail, require_constant, constructor_constant, ofwhat) { if (raw_constructor) return process_init_constructor (type, inside_init, - 0, constructor_constant, + NULL_PTR, constructor_constant, constructor_constant, ofwhat); else if (tail != 0) { *tail = old_tail_contents; - return process_init_constructor (type, 0, tail, constructor_constant, + return process_init_constructor (type, NULL_TREE, tail, + constructor_constant, constructor_constant, ofwhat); } else if (flag_traditional) /* Traditionally one can say `char x[100] = 0;'. */ return process_init_constructor (type, - build_nt (CONSTRUCTOR, 0, - tree_cons (0, inside_init, 0)), - 0, constructor_constant, + build_nt (CONSTRUCTOR, NULL_TREE, + tree_cons (NULL_TREE, + inside_init, + NULL_TREE)), + NULL_PTR, constructor_constant, constructor_constant, ofwhat); } @@ -4906,7 +4909,8 @@ process_init_constructor (type, init, elts, constant_value, constant_element, TREE_VALUE (tail), &tail1, /* Both of these are the same because a value here is an elt overall. */ - constant_element, constant_element, 0); + constant_element, constant_element, + NULL_PTR); }); if (tail1 != 0 && TREE_CODE (tail1) != TREE_LIST) @@ -4915,7 +4919,7 @@ process_init_constructor (type, init, elts, constant_value, constant_element, { error_init ( "non-empty initializer for array%s of empty elements", - " `%s'", 0); + " `%s'", NULL_PTR); /* Just ignore what we were supposed to use. */ tail1 = 0; } @@ -5015,7 +5019,8 @@ process_init_constructor (type, init, elts, constant_value, constant_element, push_member_name (IDENTIFIER_POINTER (DECL_NAME (field))); next1 = digest_init (TREE_TYPE (field), TREE_VALUE (tail), &tail1, - constant_element, constant_element, 0); + constant_element, constant_element, + NULL_PTR); }); if (tail1 != 0 && TREE_CODE (tail1) != TREE_LIST) abort (); @@ -5103,7 +5108,7 @@ process_init_constructor (type, init, elts, constant_value, constant_element, push_member_name (IDENTIFIER_POINTER (DECL_NAME (field))); next1 = digest_init (TREE_TYPE (field), TREE_VALUE (tail), &tail1, - constant_value, constant_element, 0); + constant_value, constant_element, NULL_PTR); }); if (tail1 != 0 && TREE_CODE (tail1) != TREE_LIST) abort (); @@ -5134,12 +5139,12 @@ process_init_constructor (type, init, elts, constant_value, constant_element, if (TREE_CODE (type) == UNION_TYPE) { pedwarn_init ("excess elements in union initializer%s", - " after `%s'", 0); + " after `%s'", NULL_PTR); } else { pedwarn_init ("excess elements in aggregate initializer%s", - " after `%s'", 0); + " after `%s'", NULL_PTR); } } @@ -5293,7 +5298,7 @@ c_expand_start_case (exp) exp = default_conversion (exp); type = TREE_TYPE (exp); - index = get_unwidened (exp, 0); + index = get_unwidened (exp, NULL_TREE); /* We can't strip a conversion from a signed type to an unsigned, because if we did, int_fits_type_p would do the wrong thing when checking case values for being in range, diff --git a/gcc/cccp.c b/gcc/cccp.c index 93f77027ca7..a9e2f94f402 100644 --- a/gcc/cccp.c +++ b/gcc/cccp.c @@ -120,6 +120,14 @@ typedef struct { unsigned :16, :16, :16; } vms_ino_t; #define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) #endif +#ifndef NULL +#define NULL 0 +#endif + +#ifndef NULL_PTR +#define NULL_PTR (char *) NULL +#endif + /* Exported declarations. */ char *xmalloc (); @@ -1589,7 +1597,7 @@ main (argc, argv) perror_with_name (pend_files[i]); return FAILURE_EXIT_CODE; } - finclude (fd, pend_files[i], &outbuf, 0, 0); + finclude (fd, pend_files[i], &outbuf, 0, NULL_PTR); } no_output--; @@ -1773,7 +1781,7 @@ main (argc, argv) perror_with_name (pend_includes[i]); return FAILURE_EXIT_CODE; } - finclude (fd, pend_includes[i], &outbuf, 0, 0); + finclude (fd, pend_includes[i], &outbuf, 0, NULL_PTR); } /* Scan the input, processing macros and directives. */ @@ -3329,7 +3337,8 @@ handle_directive (ip, op) case '\"': { register U_CHAR *bp1 - = skip_quoted_string (xp - 1, bp, ip->lineno, 0, 0, 0); + = skip_quoted_string (xp - 1, bp, ip->lineno, + NULL_PTR, NULL_PTR, NULL_PTR); while (xp != bp1) if (*xp == '\\') { if (*++xp != '\n') @@ -4307,8 +4316,8 @@ check_preconditions (prec) HASHNODE *hp; prec += 6; - mdef = create_definition (prec, lineend, 0); - + mdef = create_definition (prec, lineend, NULL_PTR); + if (mdef.defn == 0) abort(); @@ -4695,7 +4704,7 @@ create_definition (buf, limit, op) if (is_hor_space[*bp]) ++bp; /* skip exactly one blank/tab char */ /* now everything from bp before limit is the definition. */ - defn = collect_expansion (bp, limit, -1, 0); + defn = collect_expansion (bp, limit, -1, NULL_PTR); defn->args.argnames = (U_CHAR *) ""; } @@ -5452,7 +5461,7 @@ read_token_list (bpp, limit, error_flag) break; bp++; } else if (*bp == '"' || *bp == '\'') - bp = skip_quoted_string (bp, limit, 0, 0, 0, &eofp); + bp = skip_quoted_string (bp, limit, 0, NULL_PTR, NULL_PTR, &eofp); else while (! is_hor_space[*bp] && *bp != '(' && *bp != ')' && *bp != '"' && *bp != '\'' && bp != limit) @@ -5911,7 +5920,7 @@ do_if (buf, limit, op, keyword) FILE_BUF *ip = &instack[indepth]; value = eval_if_expression (buf, limit - buf); - conditional_skip (ip, value == 0, T_IF, 0); + conditional_skip (ip, value == 0, T_IF, NULL_PTR); return 0; } @@ -6142,7 +6151,8 @@ skip_if_group (ip, any) break; case '\"': case '\'': - bp = skip_quoted_string (bp - 1, endb, ip->lineno, &ip->lineno, 0, 0); + bp = skip_quoted_string (bp - 1, endb, ip->lineno, &ip->lineno, + NULL_PTR, NULL_PTR); break; case '\\': /* Char after backslash loses its special meaning. */ @@ -6674,7 +6684,7 @@ skip_paren_group (ip) case '\'': { int eofp = 0; - p = skip_quoted_string (p - 1, limit, 0, 0, 0, &eofp); + p = skip_quoted_string (p - 1, limit, 0, NULL_PTR, NULL_PTR, &eofp); if (eofp) return ip->bufp = p; } @@ -6844,7 +6854,7 @@ macroexpand (hp, op) parse_error = macarg (&args[i], rest_args); } else - parse_error = macarg (0, 0); + parse_error = macarg (NULL_PTR, 0); if (parse_error) { error_with_line (line_for_error (start_line), parse_error); break; @@ -7505,6 +7515,7 @@ delete_newlines (start, length) void error (msg, arg1, arg2, arg3) char *msg; + char *arg1, *arg2, *arg3; { int i; FILE_BUF *ip = NULL; @@ -7557,6 +7568,7 @@ error_from_errno (name) void warning (msg, arg1, arg2, arg3) char *msg; + char *arg1, *arg2, *arg3; { int i; FILE_BUF *ip = NULL; @@ -7586,6 +7598,7 @@ static void error_with_line (line, msg, arg1, arg2, arg3) int line; char *msg; + char *arg1, *arg2, *arg3; { int i; FILE_BUF *ip = NULL; @@ -7610,6 +7623,7 @@ error_with_line (line, msg, arg1, arg2, arg3) void pedwarn (msg, arg1, arg2, arg3) char *msg; + char *arg1, *arg2, *arg3; { if (pedantic_errors) error (msg, arg1, arg2, arg3); @@ -7625,6 +7639,7 @@ pedwarn_with_file_and_line (file, line, msg, arg1, arg2, arg3) char *file; int line; char *msg; + char *arg1, *arg2, *arg3; { int i; if (!pedantic_errors && inhibit_warnings) @@ -8001,7 +8016,8 @@ dump_defn_1 (base, start, length, of) if (*p != '\n') putc (*p, of); else if (*p == '\"' || *p =='\'') { - U_CHAR *p1 = skip_quoted_string (p, limit, 0, 0, 0, 0); + U_CHAR *p1 = skip_quoted_string (p, limit, 0, NULL_PTR, + NULL_PTR, NULL_PTR); fwrite (p, p1 - p, 1, of); p = p1 - 1; } @@ -8314,7 +8330,7 @@ make_assertion (option, str) /* pass NULL as output ptr to do_define since we KNOW it never does any output.... */ - do_assert (buf, buf + strlen (buf) , NULL, kt); + do_assert (buf, buf + strlen (buf) , NULL_PTR, kt); --indepth; } -- 2.30.2