Index | Thread | Search

From:
Miod Vallat <miod@online.fr>
Subject:
Re: allow base-gcc to be build by clang
To:
Martijn van Duren <openbsd+tech@list.imperialat.at>
Cc:
tech@openbsd.org
Date:
Mon, 9 Nov 2026 20:48:51 +0000

Download raw body.

Thread
> Sometimes you want a bit snappier machine to test something with
> base-gcc. But if the compiler is identified as clang it forces
> you to gcc, which creates a chicken-egg problem.
> 
> Building with egcc works fine, and modifying
> gnu/usr.bin/cc/Makefile.inc's CC= would allow to create a working
> gcc, but why install a package to do so. The diff below allows me to
> build gcc, install it, and rebuild gcc with said gcc.
> 
> directive.c: struct directive's name is being used in conjunction with
>   printf("%s"), same for dir, so these should be safe to remove the U.
> lex.c: digraph_spellings are assigned to CPPCHAR_SIGNED_T in some places
>   and char in other places, but the individual characters are accessed
>   via index, which would treat them as a unsigned char anyway, so this
>   appears to be treated as char anyway.
> macro.c: result, is an unsigned char, pfile's date, and time are both
>   unsigned char, and are constructed via sprintf, and pbuffer's
>   timestamp is constructed with asctime.
> So in cases it doesn't make sense to use U"".
> 
> OK?

I have the same diff, but I replaced U"whatever" with
(void *)U"whatever", not sure which version is better.

Another chunk I have for that same reason is this:

Index: gnu/usr.bin/gcc/gcc/cp/cfns.h
===================================================================
RCS file: /OpenBSD/src/gnu/usr.bin/gcc/gcc/cp/cfns.h,v
diff -u -p -u -p -r1.1.1.1 cfns.h
--- gnu/usr.bin/gcc/gcc/cp/cfns.h	29 Nov 2003 12:25:37 -0000	1.1.1.1
+++ gnu/usr.bin/gcc/gcc/cp/cfns.h	4 Jul 2025 18:00:23 -0000
@@ -7,7 +7,7 @@ static unsigned int hash PARAMS ((const 
 #ifdef __GNUC__
 __inline
 #endif
-const char * libc_name_p PARAMS ((const char *, unsigned int));
+static const char * libc_name_p PARAMS ((const char *, unsigned int));
 /* maximum key range = 480, duplicates = 1 */
 
 #ifdef __GNUC__
@@ -73,6 +73,7 @@ hash (str, len)
   return hval + asso_values[(unsigned char)str[len - 1]];
 }
 
+static
 #ifdef __GNUC__
 __inline
 #endif