Login | Register
My pages Projects Community openCollabNet

Discussions > dev [DISABLED] > Re: [PATCH] Remove warning about code not beeing executed

subversion
Discussion topic

Back to topic list

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

Author julianfoad
Full name Julian Foad
Date 2009-11-05 11:23:59 PST
Message On Thu, 2009-11-05 at 20:57 +0200, Daniel Shahaf wrote:
> 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.

I think "apr.h" is generated by the APR build to match the platform it's
built on.

> 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
> ]]]
>
> ?

I don't think GCC would notice.

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

BTW, I am not saying any of these things are likely, just that they are
theoretically possible.

- Julian

« Previous message in topic | 5 of 7 | Next message in topic »

Messages

Show all messages in topic

[PATCH] Remove warning about code not beeing executed dannas Daniel Näslund 2009-11-05 10:28:26 PST
     Re: [PATCH] Remove warning about code not beeing executed stsp Stefan Sperling 2009-11-05 10:35:04 PST
         Re: [PATCH] Remove warning about code not beeing executed julianfoad Julian Foad 2009-11-05 10:50:26 PST
             Re: [PATCH] Remove warning about code not beeing executed Daniel Shahaf <d dot s at daniel dot shahaf dot name> Daniel Shahaf <d dot s at daniel dot shahaf dot name> 2009-11-05 10:58:23 PST
                 Re: [PATCH] Remove warning about code not beeing executed julianfoad Julian Foad 2009-11-05 11:23:59 PST
         Re: [PATCH] Remove warning about code not beeing executed brane Branko Cibej 2009-11-05 13:25:23 PST
             Re: [PATCH] Remove warning about code not beeing executed dlr Daniel Rall 2009-11-05 16:33:27 PST
Messages per page: