This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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:

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
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

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]