From 67c8d2954f992a82ed6fdc05beebb18c079825f6 Mon Sep 17 00:00:00 2001 From: rillig Date: Mon, 19 Feb 2007 14:50:33 +0000 Subject: The ABI for which the code should be generated can be queried from the wrapper_abi variable. This is used in the MIPSpro wrapper to reject any package that tries to compile a file for the wrong ABI. This is not just a warning because such a package most likely has more severe problems. The gcc -Wall option seems to be similar to the MIPSpro -fullwarn option, so map them. --- mk/wrapper/bsd.wrapper.mk | 3 ++- mk/wrapper/transform-mipspro-cc | 11 +++++++++-- mk/wrapper/wrapper-subr.sh | 9 ++++++++- mk/wrapper/wrapper.sh | 10 +++++++++- 4 files changed, 28 insertions(+), 5 deletions(-) diff --git a/mk/wrapper/bsd.wrapper.mk b/mk/wrapper/bsd.wrapper.mk index f26c9a5e5d7..a1395948982 100644 --- a/mk/wrapper/bsd.wrapper.mk +++ b/mk/wrapper/bsd.wrapper.mk @@ -1,4 +1,4 @@ -# $NetBSD: bsd.wrapper.mk,v 1.64 2007/02/18 23:49:44 rillig Exp $ +# $NetBSD: bsd.wrapper.mk,v 1.65 2007/02/19 14:50:33 rillig Exp $ # # Copyright (c) 2005 The NetBSD Foundation, Inc. # All rights reserved. @@ -353,6 +353,7 @@ _WRAP_SH_CRUNCH_FILTER= \ ${GREP} -v "^\#$$" | ${GREP} -v "^[ ]*$$" _WRAP_SUBST_SED= \ + -e "s|@ABI@|${ABI:Q}|g" \ -e "s|@CAT@|${CAT:Q}|g" \ -e "s|@ECHO@|${ECHO:Q}|g" \ -e "s|@EXPR@|${EXPR:Q}|g" \ diff --git a/mk/wrapper/transform-mipspro-cc b/mk/wrapper/transform-mipspro-cc index df76039f7ea..9ea3d1c4cfe 100644 --- a/mk/wrapper/transform-mipspro-cc +++ b/mk/wrapper/transform-mipspro-cc @@ -1,4 +1,4 @@ -# $NetBSD: transform-mipspro-cc,v 1.7 2007/02/18 23:59:57 rillig Exp $ +# $NetBSD: transform-mipspro-cc,v 1.8 2007/02/19 14:50:33 rillig Exp $ # # Copyright (c) 2004 The NetBSD Foundation, Inc. # All rights reserved. @@ -63,12 +63,19 @@ case $arg in -32 |\ -n32 |\ --64 ) transform_pass ;; +-64 ) if [ $arg = "-$wrapper_abi" ]; then + transform_pass + else + transform_fail "Wrong ABI argument $arg for ABI $wrapper_abi." + fi ;; -c99 |\ -M |\ -MDupdate ) transform_pass ;; +-W |\ +-Wall ) transform_to "-fullwarn" ;; + # Ignore all of the other -W* directives, which are likely to be # GCCisms. -W* ) transform_discard_with_warning ;; diff --git a/mk/wrapper/wrapper-subr.sh b/mk/wrapper/wrapper-subr.sh index ac7d194679f..57d1d444ef0 100644 --- a/mk/wrapper/wrapper-subr.sh +++ b/mk/wrapper/wrapper-subr.sh @@ -1,4 +1,4 @@ -# $NetBSD: wrapper-subr.sh,v 1.7 2006/11/30 12:59:56 rillig Exp $ +# $NetBSD: wrapper-subr.sh,v 1.8 2007/02/19 14:50:33 rillig Exp $ # # This file contains shell functions that are useful to the wrapper # scripts. @@ -53,3 +53,10 @@ transform_pass_with_warning() { $debug_log $wrapperlog " ($wrapsubr_name) to: $arg [unchanged]" addtocache=no } + +# usage: transform_fail "error message" +transform_fail() { + msg_log "$wrapperlog" "ERROR: [$wrapsubr_name] $1" + msg_log stderr "ERROR: [$wrapsubr_name] $1" + exit 1 +} diff --git a/mk/wrapper/wrapper.sh b/mk/wrapper/wrapper.sh index b03087d23f8..1de2ab4d937 100644 --- a/mk/wrapper/wrapper.sh +++ b/mk/wrapper/wrapper.sh @@ -1,6 +1,6 @@ #! @WRAPPER_SHELL@ # -# $NetBSD: wrapper.sh,v 1.14 2007/02/06 20:33:51 rillig Exp $ +# $NetBSD: wrapper.sh,v 1.15 2007/02/19 14:50:33 rillig Exp $ # # Copyright (c) 2004 The NetBSD Foundation, Inc. # All rights reserved. @@ -38,6 +38,7 @@ #set -eu +# The list of include files for the wrapper. arg_pp="@_WRAP_ARG_PP@" arg_pp_main="@_WRAP_ARG_PP_MAIN@" arg_source="@_WRAP_ARG_SOURCE@" @@ -53,11 +54,18 @@ scan="@_WRAP_SCAN@" transform="@_WRAP_TRANSFORM@" transform_sed="@_WRAP_TRANSFORM_SED@" wrapper_subr_sh="@_WRAP_SUBR_SH@" + +# Information about the wrapper and its environment. +wrapper_abi="@ABI@" wrapper_type="@_WRAP_TYPE@" wrapperlog="${WRAPPER_LOG-@_WRAP_LOG@}" skip_transform="${WRAPPER_SKIP_TRANSFORM-@_WRAP_SKIP_TRANSFORM@}" debug="${WRAPPER_DEBUG-@WRAPPER_DEBUG@}" +# Tools that can be used by the wrapper. +# XXX: Why is this necessary? Isn't the wrapper only called with +# TOOLS_DIR/bin in the PATH? +# cat="@CAT@" echo="@ECHO@" expr="@EXPR@" -- cgit v1.2.3