build: Use -nostdinc generating macro_list [PR109522]

Message ID 20230415120105.131576-1-xry111@xry111.site
State New
Headers
Series build: Use -nostdinc generating macro_list [PR109522] |

Commit Message

Xi Ruoyao April 15, 2023, 12:01 p.m. UTC
  This prevents a spurious message building a cross-compiler when target
libc is not installed yet:

    cc1: error: no include path in which to search for stdc-predef.h

As stdc-predef.h was added to define __STDC_* macros by libc, it's
unlikely the header will ever contain some bad definitions w/o "__"
prefix so it should be safe.

gcc/ChangeLog:

	PR other/109522
	* Makefile.in (s-macro_list): Pass -nostdinc to
	$(GCC_FOR_TARGET).
---
 gcc/Makefile.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Jeff Law April 29, 2023, 6:05 p.m. UTC | #1
On 4/15/23 06:01, Xi Ruoyao via Gcc-patches wrote:
> This prevents a spurious message building a cross-compiler when target
> libc is not installed yet:
> 
>      cc1: error: no include path in which to search for stdc-predef.h
> 
> As stdc-predef.h was added to define __STDC_* macros by libc, it's
> unlikely the header will ever contain some bad definitions w/o "__"
> prefix so it should be safe.
> 
> gcc/ChangeLog:
> 
> 	PR other/109522
> 	* Makefile.in (s-macro_list): Pass -nostdinc to
> 	$(GCC_FOR_TARGET).
OK.  Thanks.

jeff
  
Xi Ruoyao May 6, 2023, 5:01 p.m. UTC | #2
On Sat, 2023-04-29 at 12:05 -0600, Jeff Law wrote:
> 
> 
> On 4/15/23 06:01, Xi Ruoyao via Gcc-patches wrote:
> > This prevents a spurious message building a cross-compiler when
> > target
> > libc is not installed yet:
> > 
> >      cc1: error: no include path in which to search for stdc-
> > predef.h
> > 
> > As stdc-predef.h was added to define __STDC_* macros by libc, it's
> > unlikely the header will ever contain some bad definitions w/o "__"
> > prefix so it should be safe.
> > 
> > gcc/ChangeLog:
> > 
> >         PR other/109522
> >         * Makefile.in (s-macro_list): Pass -nostdinc to
> >         $(GCC_FOR_TARGET).
> OK.  Thanks.
> 
> jeff

Pushed r14-544.
  

Patch

diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index ad9a5d94cd0..eb26d5c7be5 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -3215,7 +3215,7 @@  install-gcc-tooldir:
 
 macro_list: s-macro_list; @true
 s-macro_list : $(GCC_PASSES) cc1$(exeext)
-	echo | $(GCC_FOR_TARGET) -E -dM - | \
+	echo | $(GCC_FOR_TARGET) -nostdinc -E -dM - | \
 	  sed -n -e 's/^#define \([^_][a-zA-Z0-9_]*\).*/\1/p' \
 		 -e 's/^#define \(_[^_A-Z][a-zA-Z0-9_]*\).*/\1/p' | \
 	  sort -u > tmp-macro_list