This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
[committed] Fix warning from bfd/som.c
- From: "John David Anglin" <dave at hiauly1 dot hia dot nrc dot ca>
- To: binutils at sources dot redhat dot com
- Date: Fri, 14 May 2004 13:47:30 -0400 (EDT)
- Subject: [committed] Fix warning from bfd/som.c
The identifier `log2' is a C99 function and conflicts with a builtin
in GCC 3.4. This function is essentially identical to one in GCC.
I renamed it to match the GCC name.
Dave
--
J. David Anglin dave.anglin@nrc-cnrc.gc.ca
National Research Council of Canada (613) 990-0752 (FAX: 952-6602)
2004-05-14 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
* som.c (log2): Rename to exact_log2. Adjust all callers.
Index: som.c
===================================================================
RCS file: /cvs/src/src/bfd/som.c,v
retrieving revision 1.41
diff -u -3 -p -r1.41 som.c
--- som.c 2 May 2004 06:21:08 -0000 1.41
+++ som.c 14 May 2004 17:28:00 -0000
@@ -209,7 +209,7 @@ static void som_get_symbol_info
PARAMS ((bfd *, asymbol *, symbol_info *));
static asection * bfd_section_from_som_symbol
PARAMS ((bfd *, struct symbol_dictionary_record *));
-static int log2
+static int exact_log2
PARAMS ((unsigned int));
static bfd_reloc_status_type hppa_som_reloc
PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
@@ -1431,11 +1431,11 @@ som_reloc_call (abfd, p, subspace_reloc_
return p;
}
-/* Return the logarithm of X, base 2, considering X unsigned.
- Abort -1 if X is not a power or two or is zero. */
+/* Return the logarithm of X, base 2, considering X unsigned,
+ if X is a power of 2. Otherwise, returns -1. */
static int
-log2 (x)
+exact_log2 (x)
unsigned int x;
{
int log = 0;
@@ -1970,7 +1970,7 @@ setup_sections (abfd, file_hdr, current_
record. */
space_asect->vma = subspace.subspace_start;
space_asect->filepos = subspace.file_loc_init_value + current_offset;
- space_asect->alignment_power = log2 (subspace.alignment);
+ space_asect->alignment_power = exact_log2 (subspace.alignment);
if (space_asect->alignment_power == (unsigned) -1)
goto error_return;
@@ -2100,7 +2100,7 @@ setup_sections (abfd, file_hdr, current_
subspace_asect->_raw_size = subspace.subspace_length;
subspace_asect->filepos = (subspace.file_loc_init_value
+ current_offset);
- subspace_asect->alignment_power = log2 (subspace.alignment);
+ subspace_asect->alignment_power = exact_log2 (subspace.alignment);
if (subspace_asect->alignment_power == (unsigned) -1)
goto error_return;
}