public inbox for ecos-patches@sourceware.org
 help / color / mirror / Atom feed
* [issue 1000636] tidy tm_basic max macro
@ 2008-11-14 14:10 Jonathan Larmour
  2008-11-14 14:30 ` Gary Thomas
  0 siblings, 1 reply; 3+ messages in thread
From: Jonathan Larmour @ 2008-11-14 14:10 UTC (permalink / raw)
  To: ecos-patches

Index: ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/kernel/current/ChangeLog,v
retrieving revision 1.144
diff -u -5 -p -r1.144 ChangeLog
--- ChangeLog	15 Sep 2007 14:42:39 -0000	1.144
+++ ChangeLog	14 Nov 2008 14:09:32 -0000
@@ -1,5 +1,10 @@
+2008-11-14  Jonathan Larmour  <jifl@eCosCentric.com>
+
+	* tests/tm_basic.cxx (max): Resolve issue 1000636 with extra
+	bracketing.
+
 2007-08-23  Hans Rosenfeld  <rosenfeld@grumpf.hope-2000.org>
 
 	* tests/intr0.cxx, tests/kintr0.c: As suggested by Bart Veer,
 	priorities of the interrupts created by intr0 and kintr0 can now
 	be overridden by the HAL through HAL_INTR_TEST_PRIO_x constants.
Index: tests/tm_basic.cxx
===================================================================
RCS file: /cvs/ecos/ecos/packages/kernel/current/tests/tm_basic.cxx,v
retrieving revision 1.23
diff -u -5 -p -r1.23 tm_basic.cxx
--- tests/tm_basic.cxx	8 Jan 2007 16:20:14 -0000	1.23
+++ tests/tm_basic.cxx	14 Nov 2008 14:09:33 -0000
@@ -208,11 +208,11 @@ void run_semaphore_circuit_test(void);
 void run_counter_tests(void);
 void run_flag_tests(void);
 void run_alarm_tests(void);
 
 #ifndef max
-#define max(n,m) (m > n ? n : m)
+#define max(n,m) ((m) > (n) ? (n) : (m))
 #endif
 
 // Wait until a clock tick [real time clock] has passed.  This should keep it
 // from happening again during a measurement, thus minimizing any fluctuations
 void

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [issue 1000636] tidy tm_basic max macro
  2008-11-14 14:10 [issue 1000636] tidy tm_basic max macro Jonathan Larmour
@ 2008-11-14 14:30 ` Gary Thomas
  2008-11-14 15:31   ` Jonathan Larmour
  0 siblings, 1 reply; 3+ messages in thread
From: Gary Thomas @ 2008-11-14 14:30 UTC (permalink / raw)
  To: Jonathan Larmour; +Cc: ecos-patches

Jonathan Larmour wrote:
> Index: ChangeLog
> ===================================================================
> RCS file: /cvs/ecos/ecos/packages/kernel/current/ChangeLog,v
> retrieving revision 1.144
> diff -u -5 -p -r1.144 ChangeLog
> --- ChangeLog	15 Sep 2007 14:42:39 -0000	1.144
> +++ ChangeLog	14 Nov 2008 14:09:32 -0000
> @@ -1,5 +1,10 @@
> +2008-11-14  Jonathan Larmour  <jifl@eCosCentric.com>
> +
> +	* tests/tm_basic.cxx (max): Resolve issue 1000636 with extra
> +	bracketing.
> +
>  2007-08-23  Hans Rosenfeld  <rosenfeld@grumpf.hope-2000.org>
>  
>  	* tests/intr0.cxx, tests/kintr0.c: As suggested by Bart Veer,
>  	priorities of the interrupts created by intr0 and kintr0 can now
>  	be overridden by the HAL through HAL_INTR_TEST_PRIO_x constants.
> Index: tests/tm_basic.cxx
> ===================================================================
> RCS file: /cvs/ecos/ecos/packages/kernel/current/tests/tm_basic.cxx,v
> retrieving revision 1.23
> diff -u -5 -p -r1.23 tm_basic.cxx
> --- tests/tm_basic.cxx	8 Jan 2007 16:20:14 -0000	1.23
> +++ tests/tm_basic.cxx	14 Nov 2008 14:09:33 -0000
> @@ -208,11 +208,11 @@ void run_semaphore_circuit_test(void);
>  void run_counter_tests(void);
>  void run_flag_tests(void);
>  void run_alarm_tests(void);
>  
>  #ifndef max
> -#define max(n,m) (m > n ? n : m)
> +#define max(n,m) ((m) > (n) ? (n) : (m))
>  #endif
>  
>  // Wait until a clock tick [real time clock] has passed.  This should keep it
>  // from happening again during a measurement, thus minimizing any fluctuations
>  void

Hmm - this seems to be backwards (been so forever?)  I see that you changed
it the other way around.

Is/was the macro 'max()' defined someplace, maybe by a compiler, etc?
Did this change, or how did we get away with this for a decade?


-- 
------------------------------------------------------------
Gary Thomas                 |  Consulting for the
MLB Associates              |    Embedded world
------------------------------------------------------------

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [issue 1000636] tidy tm_basic max macro
  2008-11-14 14:30 ` Gary Thomas
@ 2008-11-14 15:31   ` Jonathan Larmour
  0 siblings, 0 replies; 3+ messages in thread
From: Jonathan Larmour @ 2008-11-14 15:31 UTC (permalink / raw)
  To: Gary Thomas; +Cc: ecos-patches

Gary Thomas wrote:
> 
> Is/was the macro 'max()' defined someplace, maybe by a compiler, etc?
> Did this change, or how did we get away with this for a decade?

A compiler wouldn't have. We've got away with it because it was only used
to limit the maximum values of the various resources. It wouldn't really
cause problems as such. There was already magic there after all to ensure
it all fitted into CYGMEM_REGION_ram_SIZE.

Jifl
-- 
eCosCentric Limited      http://www.eCosCentric.com/     The eCos experts
Barnwell House, Barnwell Drive, Cambridge, UK.       Tel: +44 1223 245571
Registered in England and Wales: Reg No 4422071.
------["Si fractum non sit, noli id reficere"]------       Opinions==mine

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-11-14 15:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-11-14 14:10 [issue 1000636] tidy tm_basic max macro Jonathan Larmour
2008-11-14 14:30 ` Gary Thomas
2008-11-14 15:31   ` Jonathan Larmour

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).