This is the mail archive of the
ecos-patches@sourceware.org
mailing list for the eCos project.
Re: [issue 1000636] tidy tm_basic max macro
- From: Gary Thomas <gary at mlbassoc dot com>
- To: Jonathan Larmour <jlarmour at dargo dot barn dot ecoscentric dot com>
- Cc: ecos-patches at ecos dot sourceware dot org
- Date: Fri, 14 Nov 2008 07:30:01 -0700
- Subject: Re: [issue 1000636] tidy tm_basic max macro
- References: <20081114140934.634C410C2A6@dargo.barn.ecoscentric.com>
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
------------------------------------------------------------