Do we support Not ANSI C compiler?

Alan Modra amodra@gmail.com
Tue May 10 01:44:58 GMT 2022


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


More information about the Binutils mailing list