This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [C++ Patch] PR 30500


Please Paolo, don't use 0.0. Use something like 0.1 or something that
implies a change of value. I know that we do emit a warning with your
testcase since the front-end has no dataflow or value propagation.
However, in an ideal world we should not and we would like the
testcase to be still useful if that ideal world ever comes true. I
think you should test also for the positive. That is, that a warning
is given if no #pragma system_header is present.

Cheers,

Manuel.

On 26/03/07, Paolo Carlini <pcarlini@suse.de> wrote:
Mark Mitchell wrote:

>OK for mainline, as long as you check that in_system_header is restored
>upon pop_from_top_level.
>
>
I see, thanks. Therefore, later today, when testing finishes, I'm going
to commit the below variant, which uses the usual strategy to that effect.

Paolo.

/////////////

2007-03-26 Paolo Carlini <pcarlini@suse.de>

        PR c++/30500
        * pt.c (instantiate_decl): Set in_system_header.

2007-03-26 Paolo Carlini <pcarlini@suse.de>

        PR c++/30500
        * g++.dg/warn/pragma-system_header1.C: New test.
        * g++.dg/warn/pragma-system_header1.h. New.


Index: gcc/testsuite/g++.dg/warn/pragma-system_header1.C =================================================================== --- gcc/testsuite/g++.dg/warn/pragma-system_header1.C (revision 0) +++ gcc/testsuite/g++.dg/warn/pragma-system_header1.C (revision 0) @@ -0,0 +1,10 @@ +// PR c++/30500 +// { dg-options "-Wconversion" } + +#include "pragma-system_header1.h" + +void f() +{ + g<int>(); + h<int>(); +} Index: gcc/testsuite/g++.dg/warn/pragma-system_header1.h =================================================================== --- gcc/testsuite/g++.dg/warn/pragma-system_header1.h (revision 0) +++ gcc/testsuite/g++.dg/warn/pragma-system_header1.h (revision 0) @@ -0,0 +1,7 @@ +#pragma GCC system_header + +template <typename T> + int g() { double d = 0.0; return d; } + +template <typename T> + T h() { double d = 0.0; return d; } Index: gcc/cp/pt.c =================================================================== --- gcc/cp/pt.c (revision 123204) +++ gcc/cp/pt.c (working copy) @@ -13829,6 +13829,7 @@ bool pattern_defined; int need_push; location_t saved_loc = input_location; + int saved_in_system_header = in_system_header; bool external_p;

   /* This function should only be used to instantiate templates for
@@ -13911,6 +13912,7 @@
     mark_definable (d);

   input_location = DECL_SOURCE_LOCATION (d);
+  in_system_header = DECL_IN_SYSTEM_HEADER (d);

   /* If D is a member of an explicitly instantiated class template,
      and no definition is available, treat it like an implicit
@@ -14178,6 +14180,7 @@

 out:
   input_location = saved_loc;
+  in_system_header = saved_in_system_header;
   pop_deferring_access_checks ();
   pop_tinst_level ();





Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]