From: Ed Schonberg Date: Mon, 5 Sep 2005 08:04:04 +0000 (+0200) Subject: sem_warn.adb (Warn_On_Known_Condition): Refine warning when applied to a variable... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=8d7559ffd77a670e112c8d4064f66c29351a76bc;p=gcc.git sem_warn.adb (Warn_On_Known_Condition): Refine warning when applied to a variable that is statically known to be constant. 2005-09-01 Ed Schonberg * sem_warn.adb (Warn_On_Known_Condition): Refine warning when applied to a variable that is statically known to be constant. From-SVN: r103889 --- diff --git a/gcc/ada/sem_warn.adb b/gcc/ada/sem_warn.adb index 2b3dfc8d420..d3003df5400 100644 --- a/gcc/ada/sem_warn.adb +++ b/gcc/ada/sem_warn.adb @@ -1648,7 +1648,14 @@ package body Sem_Warn is end if; if True_Branch then - Error_Msg_N ("condition is always True?", Cond); + if Is_Entity_Name (Original_Node (C)) + and then Nkind (Cond) /= N_Op_Not + then + Error_Msg_NE + ("object & is always True?", Cond, Original_Node (C)); + else + Error_Msg_N ("condition is always True?", Cond); + end if; else Error_Msg_N ("condition is always False?", Cond); end if;