[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: [PATCH] Remove warning about code not beeing executed

From: Daniel Shahaf <d.s_at_daniel.shahaf.name>
Date: Thu, 5 Nov 2009 20:57:43 +0200 (Jerusalem Standard Time)

Julian Foad wrote on Thu, 5 Nov 2009 at 18:50 -0000:
> I think the ultimate analysis here is that the compiler doesn't know
> whether APR_EOL_STR ever has a different value. It warns because, in the
> current translation unit, that code will never be executed; but it
> doesn't know that sometimes we might ask it to compile with a different
> APR_EOL_STR

Hmm. dannas mentioned yesterday that apr.h defines APR_EOL_STR
unconditionally as "\n" (for him; as "\r\n" for me) --- i.e., not
wrapped in any #if.

Perhaps the warning would go away if apr.h chose between >=2 definitions
for APR_EOL_STR?

[[[
--- include/apr.h
+++ include/apr.h
@@ -N,M +N,M @@
+#ifdef WILL_NEVER_BE_DEFINED
+#define APR_EOL_STR "\r\n\p\l\u\s\p\a\d\d\i\n\g"
+#else
 #define APR_EOL_STR "\n"
+#endif
]]]

?

> So, the problem here is that the warning is based on
> insufficient information. Maybe the next version of GCC will have a way
> to indicate that, or maybe it will stop issuing that warning in cases
> like this, or ... Anyway, if the warning is not very good, not very
> helpful, then we should disable it rather than twisting the code to
> avoid triggering it. After all, with your patch to pass the string as a
> parameter, a whole-file-optimiser could optimise out your transformation
> and still generate the same warning.

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=2414878
Received on 2009-11-05 19:58:33 CET

This is an archived mail posted to the Subversion Dev mailing list.