From: Philippe Waroquiers Date: Fri, 19 Sep 2014 18:58:18 +0000 (+0000) Subject: Handle explicitely all enum values in 'switch' on AddrInfo tag X-Git-Tag: svn/VALGRIND_3_11_0~974 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=80f3d4e69ab60cd5652a9226ed2a05298a8ce4f9;p=thirdparty%2Fvalgrind.git Handle explicitely all enum values in 'switch' on AddrInfo tag (reported by Florian) Note that Addr_Undescribed will cause an assert if such an undescribed addrinfo is pretty printed, as normally such addrinfo should always be described before being pretty printed. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14558 --- diff --git a/coregrind/m_addrinfo.c b/coregrind/m_addrinfo.c index 05566fdcc3..582b960dcc 100644 --- a/coregrind/m_addrinfo.c +++ b/coregrind/m_addrinfo.c @@ -280,11 +280,14 @@ void VG_(initThreadInfo) (ThreadInfo *tinfo) void VG_(clear_addrinfo) ( AddrInfo* ai) { switch (ai->tag) { + case Addr_Undescribed: + break; + case Addr_Unknown: - break; + break; case Addr_Stack: - break; + break; case Addr_Block: break; @@ -354,6 +357,9 @@ static void pp_addrinfo_WRK ( Addr a, AddrInfo* ai, Bool mc, Bool maybe_gcc ) vg_assert (!maybe_gcc || mc); // maybe_gcc can only be given in mc mode. switch (ai->tag) { + case Addr_Undescribed: + VG_(core_panic)("mc_pp_AddrInfo Addr_Undescribed"); + case Addr_Unknown: if (maybe_gcc) { VG_(emit)( "%sAddress 0x%llx is just below the stack ptr. " diff --git a/include/pub_tool_addrinfo.h b/include/pub_tool_addrinfo.h index b07e476123..0e55042441 100644 --- a/include/pub_tool_addrinfo.h +++ b/include/pub_tool_addrinfo.h @@ -188,7 +188,8 @@ extern void VG_(describe_addr) ( Addr a, /*OUT*/AddrInfo* ai ); extern void VG_(clear_addrinfo) ( AddrInfo* ai); -/* Prints the AddrInfo ai describing a. */ +/* Prints the AddrInfo ai describing a. + Note that an ai with tag Addr_Undescribed will cause an assert.*/ extern void VG_(pp_addrinfo) ( Addr a, AddrInfo* ai ); /* Same as VG_(pp_addrinfo) but provides some memcheck specific behaviour: