public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* Do we support Not ANSI C compiler?
@ 2022-05-09  8:49 Martin Liška
  2022-05-09  9:22 ` Pedro Alves
  2022-05-10  1:44 ` Alan Modra
  0 siblings, 2 replies; 8+ messages in thread
From: Martin Liška @ 2022-05-09  8:49 UTC (permalink / raw)
  To: Binutils

Hi.

I noticed ./include/ansidecl.h contains not ANSI C path:

#else	/* Not ANSI C.  */

#define PTR		char *

/* some systems define these in header files for non-ansi mode */
#undef const
#undef volatile
#undef signed
#undef inline
#define const
#define volatile
#define signed
#define inline

#endif	/* ANSI C.  */

And my question is if we really support such compilers or can we remove the hunk?

Cheers,
Martin

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Do we support Not ANSI C compiler?
  2022-05-09  8:49 Do we support Not ANSI C compiler? Martin Liška
@ 2022-05-09  9:22 ` Pedro Alves
  2022-05-09 12:01   ` Martin Liška
  2022-05-10  1:44 ` Alan Modra
  1 sibling, 1 reply; 8+ messages in thread
From: Pedro Alves @ 2022-05-09  9:22 UTC (permalink / raw)
  To: Martin Liška, Binutils

On 2022-05-09 09:49, Martin Liška wrote:
> Hi.
> 
> I noticed ./include/ansidecl.h contains not ANSI C path:
> 
> #else	/* Not ANSI C.  */
> 
> #define PTR		char *
> 
> /* some systems define these in header files for non-ansi mode */
> #undef const
> #undef volatile
> #undef signed
> #undef inline
> #define const
> #define volatile
> #define signed
> #define inline
> 
> #endif	/* ANSI C.  */
> 
> And my question is if we really support such compilers or can we remove the hunk?

Given:

  - GCC requires C++11 nowadays,
  - GDB requires C++11 nowadays,
  - Binutils requires C99 nowadays (for over a year),

I'd think that no, we no longer support such compilers and we can remove the hunk.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Do we support Not ANSI C compiler?
  2022-05-09  9:22 ` Pedro Alves
@ 2022-05-09 12:01   ` Martin Liška
  0 siblings, 0 replies; 8+ messages in thread
From: Martin Liška @ 2022-05-09 12:01 UTC (permalink / raw)
  To: Pedro Alves, Binutils

[-- Attachment #1: Type: text/plain, Size: 822 bytes --]

On 5/9/22 11:22, Pedro Alves wrote:
> On 2022-05-09 09:49, Martin Liška wrote:
>> Hi.
>>
>> I noticed ./include/ansidecl.h contains not ANSI C path:
>>
>> #else	/* Not ANSI C.  */
>>
>> #define PTR		char *
>>
>> /* some systems define these in header files for non-ansi mode */
>> #undef const
>> #undef volatile
>> #undef signed
>> #undef inline
>> #define const
>> #define volatile
>> #define signed
>> #define inline
>>
>> #endif	/* ANSI C.  */
>>
>> And my question is if we really support such compilers or can we remove the hunk?
> 
> Given:
> 
>   - GCC requires C++11 nowadays,
>   - GDB requires C++11 nowadays,
>   - Binutils requires C99 nowadays (for over a year),
> 
> I'd think that no, we no longer support such compilers and we can remove the hunk.

All right. Thus I've just pushed sync from GCC.

Martin

[-- Attachment #2: 0001-ansidecl.h-sync-from-GCC.patch --]
[-- Type: text/x-patch, Size: 2743 bytes --]

From 35e48b6ee0b244625188f11b27808cefbeeb7666 Mon Sep 17 00:00:00 2001
From: Martin Liska <mliska@suse.cz>
Date: Mon, 9 May 2022 13:59:37 +0200
Subject: [PATCH] ansidecl.h: sync from GCC

include/ChangeLog:

	* ansidecl.h: Sync from GCC.
---
 include/ansidecl.h | 23 +++--------------------
 1 file changed, 3 insertions(+), 20 deletions(-)

diff --git a/include/ansidecl.h b/include/ansidecl.h
index 75bc24c8c07..efee5b6904b 100644
--- a/include/ansidecl.h
+++ b/include/ansidecl.h
@@ -62,7 +62,6 @@ So instead we use the macro below and test it against specific values.  */
 #define GCC_VERSION (__GNUC__ * 1000 + __GNUC_MINOR__)
 #endif /* GCC_VERSION */
 
-#if defined (__STDC__) || defined(__cplusplus) || defined (_AIX) || (defined (__mips) && defined (_SYSTYPE_SVR4)) || defined(_WIN32)
 /* All known AIX compilers implement these things (but don't always
    define __STDC__).  The RISC/OS MIPS compiler defines these things
    in SVR4 mode, but does not define __STDC__.  */
@@ -79,7 +78,7 @@ So instead we use the macro below and test it against specific values.  */
 /* inline requires special treatment; it's in C99, and GCC >=2.7 supports
    it too, but it's not in C89.  */
 #undef inline
-#if __STDC_VERSION__ >= 199901L || defined(__cplusplus) || (defined(__SUNPRO_C) && defined(__C99FEATURES__))
+#if (!defined(__cplusplus) && __STDC_VERSION__ >= 199901L) || defined(__cplusplus) || (defined(__SUNPRO_C) && defined(__C99FEATURES__))
 /* it's a keyword */
 #else
 # if GCC_VERSION >= 2007
@@ -89,22 +88,6 @@ So instead we use the macro below and test it against specific values.  */
 # endif
 #endif
 
-#else	/* Not ANSI C.  */
-
-#define PTR		char *
-
-/* some systems define these in header files for non-ansi mode */
-#undef const
-#undef volatile
-#undef signed
-#undef inline
-#define const
-#define volatile
-#define signed
-#define inline
-
-#endif	/* ANSI C.  */
-
 /* Define macros for some gcc attributes.  This permits us to use the
    macros freely, and know that they will come into play for the
    version of gcc in which they are supported.  */
@@ -356,7 +339,7 @@ So instead we use the macro below and test it against specific values.  */
 #define ENUM_BITFIELD(TYPE) unsigned int
 #endif
 
-#if __cpp_constexpr >= 200704
+#if defined(__cplusplus) && __cpp_constexpr >= 200704
 #define CONSTEXPR constexpr
 #else
 #define CONSTEXPR
@@ -419,7 +402,7 @@ So instead we use the macro below and test it against specific values.  */
 
    so that most attempts at copy are caught at compile-time.  */
 
-#if __cplusplus >= 201103
+#if defined(__cplusplus) && __cplusplus >= 201103
 #define DISABLE_COPY_AND_ASSIGN(TYPE)		\
   TYPE (const TYPE&) = delete;			\
   void operator= (const TYPE &) = delete
-- 
2.36.0


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Do we support Not ANSI C compiler?
  2022-05-09  8:49 Do we support Not ANSI C compiler? Martin Liška
  2022-05-09  9:22 ` Pedro Alves
@ 2022-05-10  1:44 ` Alan Modra
  2022-05-10  1:47   ` bfd: remove use of PTR Alan Modra
  1 sibling, 1 reply; 8+ messages in thread
From: Alan Modra @ 2022-05-10  1:44 UTC (permalink / raw)
  To: Martin Liška; +Cc: Binutils

On Mon, May 09, 2022 at 10:49:08AM +0200, Martin Liška wrote:
> Hi.
> 
> I noticed ./include/ansidecl.h contains not ANSI C path:
> 
> #else	/* Not ANSI C.  */
> 
> #define PTR		char *
> 
> /* some systems define these in header files for non-ansi mode */
> #undef const
> #undef volatile
> #undef signed
> #undef inline
> #define const
> #define volatile
> #define signed
> #define inline
> 
> #endif	/* ANSI C.  */
> 
> And my question is if we really support such compilers or can we remove the hunk?

I'd like to go further and remove the PTR define entirely, and other
messing with inline and suchlike.  I know we can't do that just yet,
and perhaps never due to other projects that make use of ansidecl.h,
but with that in mind I'm going to commit a series of patches to clean
up binutils.

Here's the first one.

	* hashtab.h (HTAB_EMPTY_ENTRY): Replace PTR with void *.
	(HTAB_DELETED_ENTRY): Likewise.

diff --git a/include/hashtab.h b/include/hashtab.h
index 7117eee2afb..e74d2226e08 100644
--- a/include/hashtab.h
+++ b/include/hashtab.h
@@ -79,12 +79,12 @@ typedef void (*htab_free_with_arg) (void *, void *);
 
 /* This macro defines reserved value for empty table entry.  */
 
-#define HTAB_EMPTY_ENTRY    ((PTR) 0)
+#define HTAB_EMPTY_ENTRY    ((void *) 0)
 
 /* This macro defines reserved value for table entry which contained
    a deleted element. */
 
-#define HTAB_DELETED_ENTRY  ((PTR) 1)
+#define HTAB_DELETED_ENTRY  ((void *) 1)
 
 /* Hash tables are of the following type.  The structure
    (implementation) of this type is not needed for using the hash

-- 
Alan Modra
Australia Development Lab, IBM

^ permalink raw reply	[flat|nested] 8+ messages in thread

* bfd: remove use of PTR
  2022-05-10  1:44 ` Alan Modra
@ 2022-05-10  1:47   ` Alan Modra
  2022-05-10  1:49     ` opcodes: " Alan Modra
  0 siblings, 1 reply; 8+ messages in thread
From: Alan Modra @ 2022-05-10  1:47 UTC (permalink / raw)
  To: binutils

	* coffcode.h (coff_write_object_contents): Don't cast to PTR.
	* elf32-csky.c (csky_elf_link_hash_traverse): Remove use of PTR
	and PARAMS.
	(csky_allocate_dynrelocs): Don't use PTR cast.
	* elf32-nios2.c (adjust_dynrelocs, allocate_dynrelocs): Replace
	PTR with void *.
	* elf32-visium.c (visium_elf_howto_parity_reloc): Likewise.
	* elfxx-ia64.c (ia64_elf_reloc): Likewise.
	* plugin.c (bfd_plugin_bfd_print_private_bfd_data): Likewise.

diff --git a/bfd/coffcode.h b/bfd/coffcode.h
index 31bd97542d0..dde8a649e43 100644
--- a/bfd/coffcode.h
+++ b/bfd/coffcode.h
@@ -3843,7 +3843,7 @@ coff_write_object_contents (bfd * abfd)
       bfd_byte *b = bfd_zmalloc (fill_size);
       if (b)
 	{
-	  bfd_bwrite ((PTR)b, fill_size, abfd);
+	  bfd_bwrite (b, fill_size, abfd);
 	  free (b);
 	}
     }
diff --git a/bfd/elf32-csky.c b/bfd/elf32-csky.c
index 87a879ea011..c601088a486 100644
--- a/bfd/elf32-csky.c
+++ b/bfd/elf32-csky.c
@@ -1181,7 +1181,7 @@ struct csky_elf_link_hash_entry
 #define csky_elf_link_hash_traverse(table, func, info)			\
   (elf_link_hash_traverse						\
    (&(table)->root,							\
-    (bool (*) PARAMS ((struct elf_link_hash_entry *, PTR))) (func),	\
+    (bool (*) (struct elf_link_hash_entry *, void *)) (func),		\
     (info)))
 
 /* Get the C-SKY ELF linker hash table from a link_info structure.  */
@@ -1659,7 +1659,7 @@ csky_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
    dynamic relocs.  */
 
 static bool
-csky_allocate_dynrelocs (struct elf_link_hash_entry *h, PTR inf)
+csky_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
 {
   struct bfd_link_info *info;
   struct csky_elf_link_hash_table *htab;
@@ -2010,7 +2010,7 @@ csky_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
 
   /* Allocate global sym .plt and .got entries, and space for global
      sym dynamic relocs.  */
-  elf_link_hash_traverse (&htab->elf, csky_allocate_dynrelocs, (PTR) info);
+  elf_link_hash_traverse (&htab->elf, csky_allocate_dynrelocs, info);
 
   /* Check for GOT overflow.  */
   if (check_got_overflow == 1
diff --git a/bfd/elf32-nios2.c b/bfd/elf32-nios2.c
index 93e503bbd79..74a9f98da3e 100644
--- a/bfd/elf32-nios2.c
+++ b/bfd/elf32-nios2.c
@@ -5413,7 +5413,7 @@ nios2_elf32_adjust_dynamic_symbol (struct bfd_link_info *info,
 
 /* Worker function for nios2_elf32_size_dynamic_sections.  */
 static bool
-adjust_dynrelocs (struct elf_link_hash_entry *h, PTR inf)
+adjust_dynrelocs (struct elf_link_hash_entry *h, void *inf)
 {
   struct bfd_link_info *info;
   struct elf32_nios2_link_hash_table *htab;
@@ -5442,7 +5442,7 @@ adjust_dynrelocs (struct elf_link_hash_entry *h, PTR inf)
    Allocate space in .plt, .got and associated reloc sections for
    dynamic relocs.  */
 static bool
-allocate_dynrelocs (struct elf_link_hash_entry *h, PTR inf)
+allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
 {
   struct bfd_link_info *info;
   struct elf32_nios2_link_hash_table *htab;
diff --git a/bfd/elf32-visium.c b/bfd/elf32-visium.c
index 4c27ba7bce2..e189647b59e 100644
--- a/bfd/elf32-visium.c
+++ b/bfd/elf32-visium.c
@@ -28,7 +28,7 @@
 #include "libiberty.h"
 
 static bfd_reloc_status_type visium_elf_howto_parity_reloc
-  (bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **);
+  (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
 
 static reloc_howto_type visium_elf_howto_table[] = {
   /* This reloc does nothing.  */
@@ -304,7 +304,7 @@ visium_parity_bit (bfd_vma insn)
 
 static bfd_reloc_status_type
 visium_elf_howto_parity_reloc (bfd * input_bfd, arelent *reloc_entry,
-			       asymbol *symbol, PTR data,
+			       asymbol *symbol, void *data,
 			       asection *input_section, bfd *output_bfd,
 			       char **error_message ATTRIBUTE_UNUSED)
 {
diff --git a/bfd/elfxx-ia64.c b/bfd/elfxx-ia64.c
index a13b3c9327c..c126adf6890 100644
--- a/bfd/elfxx-ia64.c
+++ b/bfd/elfxx-ia64.c
@@ -66,7 +66,7 @@
 static bfd_reloc_status_type
 ia64_elf_reloc (bfd *abfd ATTRIBUTE_UNUSED, arelent *reloc,
 		asymbol *sym ATTRIBUTE_UNUSED,
-		PTR data ATTRIBUTE_UNUSED, asection *input_section,
+		void *data ATTRIBUTE_UNUSED, asection *input_section,
 		bfd *output_bfd, char **error_message)
 {
   if (output_bfd)
diff --git a/bfd/plugin.c b/bfd/plugin.c
index fb45cbee514..c69fbd7b568 100644
--- a/bfd/plugin.c
+++ b/bfd/plugin.c
@@ -617,7 +617,7 @@ bfd_plugin_bfd_copy_private_symbol_data (bfd *ibfd ATTRIBUTE_UNUSED,
 }
 
 static bool
-bfd_plugin_bfd_print_private_bfd_data (bfd *abfd ATTRIBUTE_UNUSED, PTR ptr ATTRIBUTE_UNUSED)
+bfd_plugin_bfd_print_private_bfd_data (bfd *abfd ATTRIBUTE_UNUSED, void *ptr ATTRIBUTE_UNUSED)
 {
   BFD_ASSERT (0);
   return true;
@@ -749,7 +749,7 @@ bfd_plugin_canonicalize_symtab (bfd *abfd,
 
 static void
 bfd_plugin_print_symbol (bfd *abfd ATTRIBUTE_UNUSED,
-			 PTR afile ATTRIBUTE_UNUSED,
+			 void *afile ATTRIBUTE_UNUSED,
 			 asymbol *symbol ATTRIBUTE_UNUSED,
 			 bfd_print_symbol_type how ATTRIBUTE_UNUSED)
 {

-- 
Alan Modra
Australia Development Lab, IBM

^ permalink raw reply	[flat|nested] 8+ messages in thread

* opcodes: remove use of PTR
  2022-05-10  1:47   ` bfd: remove use of PTR Alan Modra
@ 2022-05-10  1:49     ` Alan Modra
  2022-05-10  1:49       ` gas: " Alan Modra
  0 siblings, 1 reply; 8+ messages in thread
From: Alan Modra @ 2022-05-10  1:49 UTC (permalink / raw)
  To: binutils

The non-cgen parts of opcodes.  I've split out cgen changes to a later
patch, since it needs to go upstream to the cgen project.

	* cr16-dis.c (print_arg): Replace PTR with void *.
	* crx-dis.c (print_arg): Likewise.
	* rl78-dis.c (print_insn_rl78_common): Don't use PTR cast.
	* rx-dis.c (print_insn_rx): Likewise.
	* visium-dis.c (print_insn_visium): Likewise.
	* z8k-dis.c (print_insn_z8k): Likewise.

diff --git a/opcodes/cr16-dis.c b/opcodes/cr16-dis.c
index 8536cf7036d..6bcba0a0bee 100644
--- a/opcodes/cr16-dis.c
+++ b/opcodes/cr16-dis.c
@@ -529,7 +529,7 @@ print_arg (argument *a, bfd_vma memaddr, struct disassemble_info *info)
   int sign_flag = 0;
   int relative = 0;
   bfd_vma number;
-  PTR stream = info->stream;
+  void *stream = info->stream;
   fprintf_ftype func = info->fprintf_func;
 
   switch (a->type)
diff --git a/opcodes/crx-dis.c b/opcodes/crx-dis.c
index a932d23d613..e27a9386daa 100644
--- a/opcodes/crx-dis.c
+++ b/opcodes/crx-dis.c
@@ -487,7 +487,7 @@ print_arg (argument *a, bfd_vma memaddr, struct disassemble_info *info)
   bfd_vma number;
   int op_index = 0;
   char string[200];
-  PTR stream = info->stream;
+  void *stream = info->stream;
   fprintf_ftype func = info->fprintf_func;
 
   switch (a->type)
diff --git a/opcodes/rl78-dis.c b/opcodes/rl78-dis.c
index 2d7ffb26eba..65e43397a05 100644
--- a/opcodes/rl78-dis.c
+++ b/opcodes/rl78-dis.c
@@ -110,7 +110,7 @@ print_insn_rl78_common (bfd_vma addr, disassemble_info * dis, RL78_Dis_Isa isa)
 #endif
   struct private priv;
 
-  dis->private_data = (PTR) &priv;
+  dis->private_data = &priv;
   rl78_data.pc = addr;
   rl78_data.dis = dis;
 
diff --git a/opcodes/rx-dis.c b/opcodes/rx-dis.c
index 74ae870a5ec..2ecedaf0361 100644
--- a/opcodes/rx-dis.c
+++ b/opcodes/rx-dis.c
@@ -221,7 +221,7 @@ print_insn_rx (bfd_vma addr, disassemble_info * dis)
   const char * s;
   struct private priv;
 
-  dis->private_data = (PTR) &priv;
+  dis->private_data = &priv;
   rx_data.pc = addr;
   rx_data.dis = dis;
 
diff --git a/opcodes/visium-dis.c b/opcodes/visium-dis.c
index 6bc45123f05..8537f5fc340 100644
--- a/opcodes/visium-dis.c
+++ b/opcodes/visium-dis.c
@@ -766,7 +766,7 @@ print_insn_visium (bfd_vma addr, disassemble_info *info)
   /* Stuff copied from m68k-dis.c.  */
   struct private priv;
   bfd_byte *buffer = priv.the_buffer;
-  info->private_data = (PTR) & priv;
+  info->private_data = &priv;
   priv.max_fetched = priv.the_buffer;
   priv.insn_start = addr;
   if (setjmp (priv.bailout) != 0)
diff --git a/opcodes/z8k-dis.c b/opcodes/z8k-dis.c
index 3629ed311ce..c4463e99c66 100644
--- a/opcodes/z8k-dis.c
+++ b/opcodes/z8k-dis.c
@@ -147,7 +147,7 @@ print_insn_z8k (bfd_vma addr, disassemble_info *info, int is_segmented)
 {
   instr_data_s instr_data;
 
-  info->private_data = (PTR) &instr_data;
+  info->private_data = &instr_data;
   instr_data.max_fetched = 0;
   instr_data.insn_start = addr;
   if (OPCODES_SIGSETJMP (instr_data.bailout) != 0)

-- 
Alan Modra
Australia Development Lab, IBM

^ permalink raw reply	[flat|nested] 8+ messages in thread

* gas: remove use of PTR
  2022-05-10  1:49     ` opcodes: " Alan Modra
@ 2022-05-10  1:49       ` Alan Modra
  2022-05-10  1:50         ` gprof: " Alan Modra
  0 siblings, 1 reply; 8+ messages in thread
From: Alan Modra @ 2022-05-10  1:49 UTC (permalink / raw)
  To: binutils

	* config/obj-evax.c (evax_symbol_new_hook): Don't cast to PTR.

diff --git a/gas/config/obj-evax.c b/gas/config/obj-evax.c
index 717d1fa5933..2f6f9887684 100644
--- a/gas/config/obj-evax.c
+++ b/gas/config/obj-evax.c
@@ -87,7 +87,7 @@ evax_symbol_new_hook (symbolS *sym)
   udata->enbsym = NULL;
   udata->origname = xstrdup (S_GET_NAME (sym));
   udata->lkindex = 0;
-  symbol_get_bfdsym(sym)->udata.p = (PTR) udata;
+  symbol_get_bfdsym(sym)->udata.p = udata;
 }
 
 void

-- 
Alan Modra
Australia Development Lab, IBM

^ permalink raw reply	[flat|nested] 8+ messages in thread

* gprof: remove use of PTR
  2022-05-10  1:49       ` gas: " Alan Modra
@ 2022-05-10  1:50         ` Alan Modra
  0 siblings, 0 replies; 8+ messages in thread
From: Alan Modra @ 2022-05-10  1:50 UTC (permalink / raw)
  To: binutils

	* basic_blocks.c: Replace uses of PTR with void * throughout.
	* cg_arcs.c: Likewise.
	* cg_print.c: Likewise.
	* hist.c: Likewise.
	* source.h: Likewise.
	* symtab.c: Likewise.

diff --git a/gprof/basic_blocks.c b/gprof/basic_blocks.c
index 8ef40106cc6..782a2829c52 100644
--- a/gprof/basic_blocks.c
+++ b/gprof/basic_blocks.c
@@ -33,10 +33,10 @@
 #include "symtab.h"
 #include "sym_ids.h"
 
-static int cmp_bb (const PTR, const PTR);
-static int cmp_ncalls (const PTR, const PTR);
+static int cmp_bb (const void *, const void *);
+static int cmp_ncalls (const void *, const void *);
 static void fskip_string (FILE *);
-static void annotate_with_count (char *, unsigned int, int, PTR);
+static void annotate_with_count (char *, unsigned int, int, void *);
 
 /* Default option values:  */
 bool bb_annotate_all_lines = false;
@@ -53,7 +53,7 @@ static long num_lines_executed;
    number, and address (in that order).  */
 
 static int
-cmp_bb (const PTR lp, const PTR rp)
+cmp_bb (const void *lp, const void *rp)
 {
   int r;
   const Sym *left = *(const Sym **) lp;
@@ -82,7 +82,7 @@ cmp_bb (const PTR lp, const PTR rp)
 /* Helper for sorting.  Order basic blocks in decreasing number of
    calls, ties are broken in increasing order of line numbers.  */
 static int
-cmp_ncalls (const PTR lp, const PTR rp)
+cmp_ncalls (const void *lp, const void *rp)
 {
   const Sym *left = *(const Sym **) lp;
   const Sym *right = *(const Sym **) rp;
@@ -317,7 +317,7 @@ print_exec_counts (void)
    that starts the basic-block.  */
 
 static void
-annotate_with_count (char *buf, unsigned int width, int line_num, PTR arg)
+annotate_with_count (char *buf, unsigned int width, int line_num, void *arg)
 {
   Source_File *sf = (Source_File *) arg;
   Sym *b;
diff --git a/gprof/cg_arcs.c b/gprof/cg_arcs.c
index 77534ae78e8..e76c2cb78cf 100644
--- a/gprof/cg_arcs.c
+++ b/gprof/cg_arcs.c
@@ -38,13 +38,13 @@
 #include "utils.h"
 #include "sym_ids.h"
 
-static int cmp_topo (const PTR, const PTR);
+static int cmp_topo (const void *, const void *);
 static void propagate_time (Sym *);
 static void cycle_time (void);
 static void cycle_link (void);
 static void inherit_flags (Sym *);
 static void propagate_flags (Sym **);
-static int cmp_total (const PTR, const PTR);
+static int cmp_total (const void *, const void *);
 
 Sym *cycle_header;
 unsigned int num_cycles;
@@ -151,7 +151,7 @@ arc_add (Sym *parent, Sym *child, unsigned long count)
 
 
 static int
-cmp_topo (const PTR lp, const PTR rp)
+cmp_topo (const void *lp, const void *rp)
 {
   const Sym *left = *(const Sym **) lp;
   const Sym *right = *(const Sym **) rp;
@@ -535,7 +535,7 @@ propagate_flags (Sym **symbols)
  * first.  All else being equal, compare by names.
  */
 static int
-cmp_total (const PTR lp, const PTR rp)
+cmp_total (const void *lp, const void *rp)
 {
   const Sym *left = *(const Sym **) lp;
   const Sym *right = *(const Sym **) rp;
diff --git a/gprof/cg_print.c b/gprof/cg_print.c
index ca71ba44aa2..9ebe171cc56 100644
--- a/gprof/cg_print.c
+++ b/gprof/cg_print.c
@@ -47,9 +47,9 @@ static void print_parents (Sym *);
 static void sort_children (Sym *);
 static void print_children (Sym *);
 static void print_line (Sym *);
-static int cmp_name (const PTR, const PTR);
-static int cmp_arc_count (const PTR, const PTR);
-static int cmp_fun_nuses (const PTR, const PTR);
+static int cmp_name (const void *, const void *);
+static int cmp_arc_count (const void *, const void *);
+static int cmp_fun_nuses (const void *, const void *);
 static void order_and_dump_functions_by_arcs
   (Arc **, unsigned long, int, Arc **, unsigned long *);
 
@@ -551,7 +551,7 @@ cg_print (Sym ** timesortsym)
 
 
 static int
-cmp_name (const PTR left, const PTR right)
+cmp_name (const void *left, const void *right)
 {
   const Sym **npp1 = (const Sym **) left;
   const Sym **npp2 = (const Sym **) right;
@@ -675,7 +675,7 @@ cg_print_index (void)
    We want to sort in descending order.  */
 
 static int
-cmp_arc_count (const PTR left, const PTR right)
+cmp_arc_count (const void *left, const void *right)
 {
   const Arc **npp1 = (const Arc **) left;
   const Arc **npp2 = (const Arc **) right;
@@ -692,7 +692,7 @@ cmp_arc_count (const PTR left, const PTR right)
    We want to sort in descending order.  */
 
 static int
-cmp_fun_nuses (const PTR left, const PTR right)
+cmp_fun_nuses (const void *left, const void *right)
 {
   const Sym **npp1 = (const Sym **) left;
   const Sym **npp2 = (const Sym **) right;
diff --git a/gprof/hist.c b/gprof/hist.c
index 141a962865f..91a0d32a7a1 100644
--- a/gprof/hist.c
+++ b/gprof/hist.c
@@ -39,7 +39,7 @@
 static void scale_and_align_entries (void);
 static void print_header (int);
 static void print_line (Sym *, double);
-static int cmp_time (const PTR, const PTR);
+static int cmp_time (const void *, const void *);
 
 /* Declarations of automatically generated functions to output blurbs.  */
 extern void flat_blurb (FILE * fp);
@@ -535,7 +535,7 @@ print_line (Sym *sym, double scale)
    lexicographic order of the function names.  */
 
 static int
-cmp_time (const PTR lp, const PTR rp)
+cmp_time (const void *lp, const void *rp)
 {
   const Sym *left = *(const Sym **) lp;
   const Sym *right = *(const Sym **) rp;
diff --git a/gprof/source.h b/gprof/source.h
index 2606581c65f..5eece6bb46c 100644
--- a/gprof/source.h
+++ b/gprof/source.h
@@ -58,6 +58,6 @@ extern Source_File *source_file_lookup_name (const char *);
    is not stdout, it should be closed when done with it.  */
 extern FILE *annotate_source
   (Source_File *sf, unsigned int max_width,
-	   void (*annote) (char *, unsigned int, int, PTR arg),
-	   PTR arg);
+	   void (*annote) (char *, unsigned int, int, void *),
+	   void *arg);
 #endif /* source_h */
diff --git a/gprof/symtab.c b/gprof/symtab.c
index ff4c18e6616..807f4b7fe94 100644
--- a/gprof/symtab.c
+++ b/gprof/symtab.c
@@ -26,7 +26,7 @@
 #include "cg_arcs.h"
 #include "corefile.h"
 
-static int cmp_addr (const PTR, const PTR);
+static int cmp_addr (const void *, const void *);
 
 Sym_Table symtab;
 
@@ -58,7 +58,7 @@ sym_init (Sym *sym)
    the global symbol survives.  */
 
 static int
-cmp_addr (const PTR lp, const PTR rp)
+cmp_addr (const void *lp, const void *rp)
 {
   const Sym *left = (const Sym *) lp;
   const Sym *right = (const Sym *) rp;

-- 
Alan Modra
Australia Development Lab, IBM

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-05-10  1:50 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-09  8:49 Do we support Not ANSI C compiler? Martin Liška
2022-05-09  9:22 ` Pedro Alves
2022-05-09 12:01   ` Martin Liška
2022-05-10  1:44 ` Alan Modra
2022-05-10  1:47   ` bfd: remove use of PTR Alan Modra
2022-05-10  1:49     ` opcodes: " Alan Modra
2022-05-10  1:49       ` gas: " Alan Modra
2022-05-10  1:50         ` gprof: " Alan Modra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).