On Mon, Mar 09, 2015 at 12:35:54PM +0100, Marek Polacek wrote: > I noticed that we can use the do_ubsan_in_current_function wrapper more, which > allows us to simplify the code a bit further. > > Ran ubsan testsuite on x86_64-linux, ok for trunk? > > 2015-03-09 Marek Polacek <pola...@redhat.com> > > * c-convert.c (convert): Make use of do_ubsan_in_current_function. > * c-decl.c (grokdeclarator): Likewise. > * c-typeck.c (build_binary_op): Likewise.
These are ok. > * cp-ubsan.c (cp_ubsan_instrument_vptr_p): Make use of > do_ubsan_in_current_function. > --- gcc/cp/cp-ubsan.c > +++ gcc/cp/cp-ubsan.c > @@ -63,9 +63,7 @@ cp_ubsan_instrument_vptr_p (tree type) > if (!flag_rtti || flag_sanitize_undefined_trap_on_error) > return false; > > - if (current_function_decl > - && lookup_attribute ("no_sanitize_undefined", > - DECL_ATTRIBUTES (current_function_decl))) > + if (!do_ubsan_in_current_function ()) > return false; > > if (type) This changes behavior. Previously it would (intentionally) instrument current_function_decl == NULL case, now it doesn't. Jakub