diff mbox

Error out on -fvtable-verify without --enable-vtable-verify

Message ID yddlh3j79oa.fsf@CeBiTec.Uni-Bielefeld.DE
State New
Headers show

Commit Message

Rainer Orth May 9, 2016, 11:28 a.m. UTC
Hi Bernd,

> On 05/08/2016 12:44 PM, Rainer Orth wrote:
>> With the recent change not to install libvtv without
>> --enable-vtable-verify, I noticed that gcc/g++ would still accept
>> -fvtable-verify without errors, only to emit obscure link-time errors
>> about missing vtv_*.o (which hadn't been installed in that situation
>> before) and libvtv.
>>
>> It seems to me a much better user experience to emit a clear error
>> message in this case, which is what this patch does.
>
> Generally ok, but...
>
>> +AC_ARG_ENABLE(vtable-verify,
>> +[AS_HELP_STRING([--enable-vtable-verify],
>> +		[enable vtable verification feature])],
>> +[case "$enableval" in
>> + yes) enable_vtable_verify=yes ;;
>> + no)  enable_vtable_verify=no ;;
>> + *)   enable_vtable_verify=no;;
>> + esac],
>> +[enable_vtable_verify=no])
>> +vtable_verify=`if test $enable_vtable_verify != no; then echo 1; else
>> echo 0; fi`
>> +AC_DEFINE_UNQUOTED(ENABLE_VTABLE_VERIFY, $vtable_verify,
>> +[Define 0/1 if vtable verification feature is enabled.])
>
> That looks a little overly complicated. Don't you get the enable_ variables
> set by autoconf? And if you do need the case statement, you might as well
> set things to 0/1 directly and skip the enable_vtable_verify variable
> entirely.

that's what you get for blindly copying configure.ac fragments.  The
following works instead:
I had to tighten the $enable_vtable_verify test to guard against a
non-no argument to --enable-vtable-verify being interpreted as yes.

Tested by just running gcc/configure without and with
--enable-vtable-verify, and with --enable-vtable-verify=nonstd (handled
as no).

Ok now?

Thanks.
        Rainer

Comments

Bernd Schmidt May 9, 2016, 11:29 a.m. UTC | #1
On 05/09/2016 01:28 PM, Rainer Orth wrote:
> Ok now?

Yes, thanks.


Bernd
diff mbox

Patch

diff --git a/gcc/configure.ac b/gcc/configure.ac
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -865,6 +865,14 @@  Valid choices are 'yes' and 'no'.]) ;;
   esac
 ], [enable_tls=''])
 
+AC_ARG_ENABLE(vtable-verify,
+[AS_HELP_STRING([--enable-vtable-verify],
+		[enable vtable verification feature])],,
+[enable_vtable_verify=no])
+vtable_verify=`if test x$enable_vtable_verify = xyes; then echo 1; else echo 0; fi`
+AC_DEFINE_UNQUOTED(ENABLE_VTABLE_VERIFY, $vtable_verify,
+[Define 0/1 if vtable verification feature is enabled.])
+
 AC_ARG_ENABLE(objc-gc,
 [AS_HELP_STRING([--enable-objc-gc],
 		[enable the use of Boehm's garbage collector with