strip -Werror: all specific or none (#30284)
Add a config option to strip `-Werror*` or `-Werror=*` from compile lines everywhere.
```yaml
config:
    keep_werror: false
```
By default, we strip all `-Werror` arguments out of compile lines, to avoid unwanted
failures when upgrading compilers.  You can re-enable `-Werror` in your builds if
you really want to, with either:
```yaml
config:
    keep_werror: all
```
or to keep *just* specific `-Werror=XXX` args:
```yaml
config:
    keep_werror: specific
```
This should make swapping in newer versions of compilers much smoother when
maintainers have decided to enable `-Werror` by default.
			
			
This commit is contained in:
		
							
								
								
									
										26
									
								
								lib/spack/env/cc
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										26
									
								
								lib/spack/env/cc
									
									
									
									
										vendored
									
									
								
							@@ -401,7 +401,8 @@ input_command="$*"
 | 
			
		||||
# command line and recombine them with Spack arguments later.  We
 | 
			
		||||
# parse these out so that we can make sure that system paths come
 | 
			
		||||
# last, that package arguments come first, and that Spack arguments
 | 
			
		||||
# are injected properly.
 | 
			
		||||
# are injected properly.  Based on configuration, we also strip -Werror
 | 
			
		||||
# arguments.
 | 
			
		||||
#
 | 
			
		||||
# All other arguments, including -l arguments, are treated as
 | 
			
		||||
# 'other_args' and left in their original order.  This ensures that
 | 
			
		||||
@@ -440,6 +441,29 @@ while [ $# -ne 0 ]; do
 | 
			
		||||
        continue
 | 
			
		||||
    fi
 | 
			
		||||
 | 
			
		||||
    if [ -n "${SPACK_COMPILER_FLAGS_KEEP}" ] ; then
 | 
			
		||||
        # NOTE: the eval is required to allow `|` alternatives inside the variable
 | 
			
		||||
        eval "\
 | 
			
		||||
        case '$1' in
 | 
			
		||||
            $SPACK_COMPILER_FLAGS_KEEP)
 | 
			
		||||
                append other_args_list "$1"
 | 
			
		||||
                shift
 | 
			
		||||
                continue
 | 
			
		||||
                ;;
 | 
			
		||||
        esac
 | 
			
		||||
        "
 | 
			
		||||
    fi
 | 
			
		||||
    if [ -n "${SPACK_COMPILER_FLAGS_REMOVE}" ] ; then
 | 
			
		||||
        eval "\
 | 
			
		||||
        case '$1' in
 | 
			
		||||
            $SPACK_COMPILER_FLAGS_REMOVE)
 | 
			
		||||
                shift
 | 
			
		||||
                continue
 | 
			
		||||
                ;;
 | 
			
		||||
        esac
 | 
			
		||||
        "
 | 
			
		||||
    fi
 | 
			
		||||
 | 
			
		||||
    case "$1" in
 | 
			
		||||
        -isystem*)
 | 
			
		||||
            arg="${1#-isystem}"
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user