diff options
-rw-r--r-- | gcc/ChangeLog | 12 | ||||
-rw-r--r-- | gcc/c-decl.c | 10 | ||||
-rw-r--r-- | gcc/cp/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/cp/tree.c | 2 | ||||
-rw-r--r-- | gcc/dwarfout.c | 2 | ||||
-rw-r--r-- | gcc/gcc.c | 6 | ||||
-rw-r--r-- | gcc/tree.c | 12 | ||||
-rw-r--r-- | gcc/varasm.c | 36 |
8 files changed, 50 insertions, 34 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 0ad0e51..c5fe3b6 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,15 @@ +2000-11-03 Joseph S. Myers <jsm28@cam.ac.uk> + + * c-decl.c (duplicate_decls, copy_lang_decl), dwarfout.c + (dwarfout_line), gcc.c (main, save_string), tree.c (init_obstacks, + perm_calloc, get_identifier, maybe_get_identifier, + real_value_from_int_cst, simple_cst_equal), varasm.c + (assemble_name, assemble_real, immed_real_const_1, + compare_constant_1, decode_rtx_const, output_constant_pool): Use + strrchr () instead of rindex (). Use memcmp () instead of bcmp + (). Use memcpy () instead of bcopy (). Use memset () instead of + bzero (). + 2000-11-03 Nathan Sidwell <nathan@codesourcery.com> * cppfiles.c (open_file): If already read, then don't reopen. diff --git a/gcc/c-decl.c b/gcc/c-decl.c index f86cb89..2bbfd46 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -2054,9 +2054,9 @@ duplicate_decls (newdecl, olddecl, different_binding_level) { register unsigned olddecl_uid = DECL_UID (olddecl); - bcopy ((char *) newdecl + sizeof (struct tree_common), - (char *) olddecl + sizeof (struct tree_common), - sizeof (struct tree_decl) - sizeof (struct tree_common)); + memcpy ((char *) olddecl + sizeof (struct tree_common), + (char *) newdecl + sizeof (struct tree_common), + sizeof (struct tree_decl) - sizeof (struct tree_common)); DECL_UID (olddecl) = olddecl_uid; } @@ -7006,8 +7006,8 @@ copy_lang_decl (decl) return; ld = (struct lang_decl *) ggc_alloc (sizeof (struct lang_decl)); - bcopy ((char *)DECL_LANG_SPECIFIC (decl), (char *)ld, - sizeof (struct lang_decl)); + memcpy ((char *) ld, (char *) DECL_LANG_SPECIFIC (decl), + sizeof (struct lang_decl)); DECL_LANG_SPECIFIC (decl) = ld; } diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 0b1a322..9075e79 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,7 @@ +2000-11-03 Joseph S. Myers <jsm28@cam.ac.uk> + + * tree.c (cp_tree_equal): Use memcmp () instead of bcmp (). + 2000-11-02 Joseph S. Myers <jsm28@cam.ac.uk> * dump.c (dequeue_and_dump), lex.c (interface_strcmp), method.c diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index db5e33d..2768ef8 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -1984,7 +1984,7 @@ cp_tree_equal (t1, t2) case STRING_CST: return TREE_STRING_LENGTH (t1) == TREE_STRING_LENGTH (t2) - && !bcmp (TREE_STRING_POINTER (t1), TREE_STRING_POINTER (t2), + && !memcmp (TREE_STRING_POINTER (t1), TREE_STRING_POINTER (t2), TREE_STRING_LENGTH (t1)); case CONSTRUCTOR: diff --git a/gcc/dwarfout.c b/gcc/dwarfout.c index 98e90c9..653f8de 100644 --- a/gcc/dwarfout.c +++ b/gcc/dwarfout.c @@ -5535,7 +5535,7 @@ dwarfout_line (filename, line) } { - register const char *tail = rindex (filename, '/'); + register const char *tail = strrchr (filename, '/'); if (tail != NULL) filename = tail; @@ -5319,8 +5319,8 @@ main (argc, argv) This means one element containing 0s, as a terminator. */ compilers = (struct compiler *) xmalloc (sizeof default_compilers); - bcopy ((char *) default_compilers, (char *) compilers, - sizeof default_compilers); + memcpy ((char *) compilers, (char *) default_compilers, + sizeof default_compilers); n_compilers = n_default_compilers; /* Read specs from a file if there is one. */ @@ -5737,7 +5737,7 @@ save_string (s, len) { register char *result = xmalloc (len + 1); - bcopy (s, result, len); + memcpy (result, s, len); result[len] = 0; return result; } @@ -205,7 +205,7 @@ init_obstacks () gcc_obstack_init (&permanent_obstack); /* Init the hash table of identifiers. */ - bzero ((char *) hash_table, sizeof hash_table); + memset ((char *) hash_table, 0, sizeof hash_table); ggc_add_tree_root (hash_table, sizeof hash_table / sizeof (tree)); /* Initialize the hash table of types. */ @@ -257,7 +257,7 @@ perm_calloc (nelem, size) long size; { char *rval = (char *) obstack_alloc (&permanent_obstack, nelem * size); - bzero (rval, nelem * size); + memset (rval, 0, nelem * size); return rval; } @@ -591,7 +591,7 @@ get_identifier (text) for (idp = hash_table[hi]; idp; idp = TREE_CHAIN (idp)) if (IDENTIFIER_LENGTH (idp) == len && IDENTIFIER_POINTER (idp)[0] == text[0] - && !bcmp (IDENTIFIER_POINTER (idp), text, len)) + && !memcmp (IDENTIFIER_POINTER (idp), text, len)) /* Return if found. */ return idp; @@ -655,7 +655,7 @@ maybe_get_identifier (text) for (idp = hash_table[hi]; idp; idp = TREE_CHAIN (idp)) if (IDENTIFIER_LENGTH (idp) == len && IDENTIFIER_POINTER (idp)[0] == text[0] - && !bcmp (IDENTIFIER_POINTER (idp), text, len)) + && !memcmp (IDENTIFIER_POINTER (idp), text, len)) return idp; /* <-- return if found */ return NULL_TREE; @@ -739,7 +739,7 @@ real_value_from_int_cst (type, i) #ifdef REAL_ARITHMETIC /* Clear all bits of the real value type so that we can later do bitwise comparisons to see if two values are the same. */ - bzero ((char *) &d, sizeof d); + memset ((char *) &d, 0, sizeof d); if (! TREE_UNSIGNED (TREE_TYPE (i))) REAL_VALUE_FROM_INT (d, TREE_INT_CST_LOW (i), TREE_INT_CST_HIGH (i), @@ -3625,7 +3625,7 @@ simple_cst_equal (t1, t2) case STRING_CST: return (TREE_STRING_LENGTH (t1) == TREE_STRING_LENGTH (t2) - && ! bcmp (TREE_STRING_POINTER (t1), TREE_STRING_POINTER (t2), + && ! memcmp (TREE_STRING_POINTER (t1), TREE_STRING_POINTER (t2), TREE_STRING_LENGTH (t1))); case CONSTRUCTOR: diff --git a/gcc/varasm.c b/gcc/varasm.c index 497931f..c422903 100644 --- a/gcc/varasm.c +++ b/gcc/varasm.c @@ -1772,7 +1772,7 @@ assemble_name (file, name) STRIP_NAME_ENCODING (real_name, name); if (flag_prefix_function_name - && ! bcmp (real_name, CHKR_PREFIX, CHKR_PREFIX_SIZE)) + && ! memcmp (real_name, CHKR_PREFIX, CHKR_PREFIX_SIZE)) real_name = real_name + CHKR_PREFIX_SIZE; id = maybe_get_identifier (real_name); @@ -1972,7 +1972,7 @@ assemble_real (d, mode) { error ("floating point trap outputting a constant"); #ifdef REAL_IS_NOT_DOUBLE - bzero ((char *) &d, sizeof d); + memset ((char *) &d, 0, sizeof d); d = dconst0; #else d = 0; @@ -2164,7 +2164,7 @@ immed_real_const_1 (d, mode) If one is found, return it. */ if (cfun != 0) for (r = const_double_chain; r; r = CONST_DOUBLE_CHAIN (r)) - if (! bcmp ((char *) &CONST_DOUBLE_LOW (r), (char *) &u, sizeof u) + if (! memcmp ((char *) &CONST_DOUBLE_LOW (r), (char *) &u, sizeof u) && GET_MODE (r) == mode) return r; @@ -2176,7 +2176,7 @@ immed_real_const_1 (d, mode) freed memory. */ r = rtx_alloc (CONST_DOUBLE); PUT_MODE (r, mode); - bcopy ((char *) &u, (char *) &CONST_DOUBLE_LOW (r), sizeof u); + memcpy ((char *) &CONST_DOUBLE_LOW (r), (char *) &u, sizeof u); /* If we aren't inside a function, don't put r on the const_double_chain. */ @@ -2533,7 +2533,7 @@ compare_constant_1 (exp, p) strp = (unsigned char *)TREE_STRING_POINTER (exp); len = TREE_STRING_LENGTH (exp); - if (bcmp ((char *) &TREE_STRING_LENGTH (exp), p, + if (memcmp ((char *) &TREE_STRING_LENGTH (exp), p, sizeof TREE_STRING_LENGTH (exp))) return 0; @@ -2555,7 +2555,7 @@ compare_constant_1 (exp, p) get_set_constructor_bytes (exp, tmp, len); strp = (unsigned char *) tmp; - if (bcmp ((char *) &xlen, p, sizeof xlen)) + if (memcmp ((char *) &xlen, p, sizeof xlen)) return 0; p += sizeof xlen; @@ -2573,7 +2573,7 @@ compare_constant_1 (exp, p) if (TREE_PURPOSE (link)) have_purpose = 1; - if (bcmp ((char *) &length, p, sizeof length)) + if (memcmp ((char *) &length, p, sizeof length)) return 0; p += sizeof length; @@ -2587,12 +2587,12 @@ compare_constant_1 (exp, p) else type = 0; - if (bcmp ((char *) &type, p, sizeof type)) + if (memcmp ((char *) &type, p, sizeof type)) return 0; if (TREE_CODE (TREE_TYPE (exp)) == ARRAY_TYPE) { - if (bcmp ((char *) &mode, p, sizeof mode)) + if (memcmp ((char *) &mode, p, sizeof mode)) return 0; p += sizeof mode; @@ -2600,7 +2600,7 @@ compare_constant_1 (exp, p) p += sizeof type; - if (bcmp ((char *) &have_purpose, p, sizeof have_purpose)) + if (memcmp ((char *) &have_purpose, p, sizeof have_purpose)) return 0; p += sizeof have_purpose; @@ -2610,7 +2610,7 @@ compare_constant_1 (exp, p) { HOST_WIDE_INT size = int_size_in_bytes (TREE_TYPE (exp)); - if (bcmp ((char *) &size, p, sizeof size)) + if (memcmp ((char *) &size, p, sizeof size)) return 0; p += sizeof size; @@ -2627,7 +2627,7 @@ compare_constant_1 (exp, p) { tree zero = 0; - if (bcmp ((char *) &zero, p, sizeof zero)) + if (memcmp ((char *) &zero, p, sizeof zero)) return 0; p += sizeof zero; @@ -2636,7 +2636,7 @@ compare_constant_1 (exp, p) if (TREE_PURPOSE (link) && TREE_CODE (TREE_PURPOSE (link)) == FIELD_DECL) { - if (bcmp ((char *) &TREE_PURPOSE (link), p, + if (memcmp ((char *) &TREE_PURPOSE (link), p, sizeof TREE_PURPOSE (link))) return 0; @@ -2651,7 +2651,7 @@ compare_constant_1 (exp, p) { int zero = 0; - if (bcmp ((char *) &zero, p, sizeof zero)) + if (memcmp ((char *) &zero, p, sizeof zero)) return 0; p += sizeof zero; @@ -3352,7 +3352,7 @@ decode_rtx_const (mode, x, value) struct rtx_const *value; { /* Clear the whole structure, including any gaps. */ - bzero (value, sizeof (struct rtx_const)); + memset (value, 0, sizeof (struct rtx_const)); value->kind = RTX_INT; /* Most usual kind. */ value->mode = mode; @@ -3364,8 +3364,8 @@ decode_rtx_const (mode, x, value) if (GET_MODE (x) != VOIDmode) { value->mode = GET_MODE (x); - bcopy ((char *) &CONST_DOUBLE_LOW (x), - (char *) &value->un.du, sizeof value->un.du); + memcpy ((char *) &value->un.du, + (char *) &CONST_DOUBLE_LOW (x), sizeof value->un.du); } else { @@ -3797,7 +3797,7 @@ output_constant_pool (fnname, fndecl) if (GET_CODE (x) != CONST_DOUBLE) abort (); - bcopy ((char *) &CONST_DOUBLE_LOW (x), (char *) &u, sizeof u); + memcpy ((char *) &u, (char *) &CONST_DOUBLE_LOW (x), sizeof u); assemble_real (u.d, pool->mode); break; |