[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

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

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


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

Received on 2009-11-05 19:58:33 CET

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