Re: [Mesa-dev] [PATCH 1/4] mesa: move declarations before code

2013-06-30 Thread Jose Fonseca


- Original Message -
> Brian Paul  writes:
> 
> > On 06/26/2013 04:33 PM, Eric Anholt wrote:
> >> Brian Paul  writes:
> >>
> >>> On 06/26/2013 03:56 PM, Ian Romanick wrote:
>  Patches 1 and 4 are
> 
>  Reviewed-by: Ian Romanick 
> 
>  For patch 3, I share Jose's concern.  I would very much like to see this
>  happen in directories containing code that will be built with MSVC.
> >>>
> >>> Yeah, sounds good, but off-hand I have no idea how to do this
> >>> per-directory.
> >>
> >> Just add it to AM_CPPFLAGS in the directories you care about.
> >
> > But only if the compiler is gcc, right?  Something like:
> >
> > if GCC
> > AM_CPPFLAGS += "-Wdeclaration-after-statement"
> > endif
> 
> Just like we do other compiler-dependent stuff -- detect compiler in
> configure.ac, AC_SUBST a variable conditionally containing the flag,
> then use it where you want.  Actually, this would need to be AM_CFLAGS
> and AM_CXXFLAGS, since it's a compiler option, not a preprocessor
> option.  VISIBILITY_CFLAGS would be an example.

BTW, it looks like we won't have to put up with this for much longer: 
http://arstechnica.com/information-technology/2013/06/c99-acknowledged-at-last-as-microsoft-lays-out-its-path-to-c14/

Jose
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 1/4] mesa: move declarations before code

2013-06-27 Thread Eric Anholt
Brian Paul  writes:

> On 06/26/2013 04:33 PM, Eric Anholt wrote:
>> Brian Paul  writes:
>>
>>> On 06/26/2013 03:56 PM, Ian Romanick wrote:
 Patches 1 and 4 are

 Reviewed-by: Ian Romanick 

 For patch 3, I share Jose's concern.  I would very much like to see this
 happen in directories containing code that will be built with MSVC.
>>>
>>> Yeah, sounds good, but off-hand I have no idea how to do this per-directory.
>>
>> Just add it to AM_CPPFLAGS in the directories you care about.
>
> But only if the compiler is gcc, right?  Something like:
>
> if GCC
> AM_CPPFLAGS += "-Wdeclaration-after-statement"
> endif

Just like we do other compiler-dependent stuff -- detect compiler in
configure.ac, AC_SUBST a variable conditionally containing the flag,
then use it where you want.  Actually, this would need to be AM_CFLAGS
and AM_CXXFLAGS, since it's a compiler option, not a preprocessor
option.  VISIBILITY_CFLAGS would be an example.


pgpsvIeyUbBCH.pgp
Description: PGP signature
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 1/4] mesa: move declarations before code

2013-06-27 Thread Jose Fonseca


- Original Message -
> On 06/26/2013 04:33 PM, Eric Anholt wrote:
> > Brian Paul  writes:
> >
> >> On 06/26/2013 03:56 PM, Ian Romanick wrote:
> >>> Patches 1 and 4 are
> >>>
> >>> Reviewed-by: Ian Romanick 
> >>>
> >>> For patch 3, I share Jose's concern.  I would very much like to see this
> >>> happen in directories containing code that will be built with MSVC.
> >>
> >> Yeah, sounds good, but off-hand I have no idea how to do this
> >> per-directory.
> >
> > Just add it to AM_CPPFLAGS in the directories you care about.
> 
> But only if the compiler is gcc, right?  Something like:
> 
> if GCC
> AM_CPPFLAGS += "-Wdeclaration-after-statement"
> endif

It's probably easier to have a conditional variable in the top .am / .ac, 

   # Additional flags for cross-platform code
   if GCC
  XPLATFORM_CFLAGS = "-Wdeclaration-after-statement"
   endif 

and then unconditionally add on each selected directory

  AM_CPPFLAGS += $(XPLATFORM_CFLAGS)

As this will mean less places to modify if we want to modify the flags, or 
which compilers they apply.
 
Jose
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 1/4] mesa: move declarations before code

2013-06-26 Thread Brian Paul

On 06/26/2013 04:33 PM, Eric Anholt wrote:

Brian Paul  writes:


On 06/26/2013 03:56 PM, Ian Romanick wrote:

Patches 1 and 4 are

Reviewed-by: Ian Romanick 

For patch 3, I share Jose's concern.  I would very much like to see this
happen in directories containing code that will be built with MSVC.


Yeah, sounds good, but off-hand I have no idea how to do this per-directory.


Just add it to AM_CPPFLAGS in the directories you care about.


But only if the compiler is gcc, right?  Something like:

if GCC
   AM_CPPFLAGS += "-Wdeclaration-after-statement"
endif


-Brian


___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 1/4] mesa: move declarations before code

2013-06-26 Thread Eric Anholt
Brian Paul  writes:

> On 06/26/2013 03:56 PM, Ian Romanick wrote:
>> Patches 1 and 4 are
>>
>> Reviewed-by: Ian Romanick 
>>
>> For patch 3, I share Jose's concern.  I would very much like to see this
>> happen in directories containing code that will be built with MSVC.
>
> Yeah, sounds good, but off-hand I have no idea how to do this per-directory.

Just add it to AM_CPPFLAGS in the directories you care about.


pgppXjPRluu2w.pgp
Description: PGP signature
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 1/4] mesa: move declarations before code

2013-06-26 Thread Brian Paul

On 06/26/2013 03:56 PM, Ian Romanick wrote:

Patches 1 and 4 are

Reviewed-by: Ian Romanick 

For patch 3, I share Jose's concern.  I would very much like to see this
happen in directories containing code that will be built with MSVC.


Yeah, sounds good, but off-hand I have no idea how to do this per-directory.




For patch 2, I think this is unnecessary if patch 3 is re-done.  Right?


Well, I was seeing a warning on a Ubuntu system from the code even 
without -Wdeclaration-after-statement and wanted to clean it up. 
Already pushed.


-Brian




On 06/26/2013 12:50 PM, Brian Paul wrote:

---
  src/mesa/program/register_allocate.c |5 +++--
  1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/mesa/program/register_allocate.c
b/src/mesa/program/register_allocate.c
index ea06a07..4eed0b5 100644
--- a/src/mesa/program/register_allocate.c
+++ b/src/mesa/program/register_allocate.c
@@ -630,9 +630,10 @@ ra_get_best_spill_node(struct ra_graph *g)
  * colored that we couldn't manage to color in ra_select().
  */
 for (i = g->stack_optimistic_start; i < g->stack_count; i++) {
+  float cost, benefit;
+
n = g->stack[i];
-  float cost = g->nodes[n].spill_cost;
-  float benefit;
+  cost = g->nodes[n].spill_cost;

if (cost <= 0.0)
   continue;



___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 1/4] mesa: move declarations before code

2013-06-26 Thread Ian Romanick

Patches 1 and 4 are

Reviewed-by: Ian Romanick 

For patch 3, I share Jose's concern.  I would very much like to see this 
happen in directories containing code that will be built with MSVC.


For patch 2, I think this is unnecessary if patch 3 is re-done.  Right?

On 06/26/2013 12:50 PM, Brian Paul wrote:

---
  src/mesa/program/register_allocate.c |5 +++--
  1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/mesa/program/register_allocate.c 
b/src/mesa/program/register_allocate.c
index ea06a07..4eed0b5 100644
--- a/src/mesa/program/register_allocate.c
+++ b/src/mesa/program/register_allocate.c
@@ -630,9 +630,10 @@ ra_get_best_spill_node(struct ra_graph *g)
  * colored that we couldn't manage to color in ra_select().
  */
 for (i = g->stack_optimistic_start; i < g->stack_count; i++) {
+  float cost, benefit;
+
n = g->stack[i];
-  float cost = g->nodes[n].spill_cost;
-  float benefit;
+  cost = g->nodes[n].spill_cost;

if (cost <= 0.0)
   continue;



___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 1/4] mesa: move declarations before code

2013-06-26 Thread Brian Paul
---
 src/mesa/program/register_allocate.c |5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/mesa/program/register_allocate.c 
b/src/mesa/program/register_allocate.c
index ea06a07..4eed0b5 100644
--- a/src/mesa/program/register_allocate.c
+++ b/src/mesa/program/register_allocate.c
@@ -630,9 +630,10 @@ ra_get_best_spill_node(struct ra_graph *g)
 * colored that we couldn't manage to color in ra_select().
 */
for (i = g->stack_optimistic_start; i < g->stack_count; i++) {
+  float cost, benefit;
+
   n = g->stack[i];
-  float cost = g->nodes[n].spill_cost;
-  float benefit;
+  cost = g->nodes[n].spill_cost;
 
   if (cost <= 0.0)
  continue;
-- 
1.7.10.4

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev