[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-libc-dev] [bug #36921] util/delay.h uses inline...
From: |
Joerg Wunsch |
Subject: |
Re: [avr-libc-dev] [bug #36921] util/delay.h uses inline... |
Date: |
Tue, 24 Jul 2012 17:44:21 +0200 |
User-agent: |
Mutt/1.5.20 (2009-06-14) |
As David Brown wrote:
> Agreed - though it is possible that some parts might require gcc
> extensions to C99. What should be done if gcc extensions are not
> required, but would allow the generation of better (smaller/faster)
> code? One possible situation here is when attributes such as "const" or
> "pure" would allow better optimisation.
So far, I don't know of any of the GCC extensions which could not be
brought in by either escaping them with two underscores, or explicitly
declaring them being __extension__. That way, you can still compile
the code with either -std=c89 -pedantic or -std=c99 -pedantic without
getting complaints. After all, we (as "vendor" of a system library)
are the prime reason for allowing that kind of properly marked
extensions.
> > Is it ok to have some modules that comply to C89, and others that can
> > never comply to C89?
I think it is.
> MISRA is currently based on C90/ANSI, AFAIK
Yes, that's the case. From the preface of MISRA-C:2004:
"While producing MISRA-C:2004, the question of addressing the 1999 C
standard [8] arose. At this time, only issues with MISRA-C:1998 are
addressed due to the limited support for C99 on embedded
microprocessors."
> I think it is perfectly reasonable to make some modules C99-only (or
> dependant on gcc extensions), if it leads to better/clearer code - but I
> agree there should be a check on versions and a nice #error message
> suggesting the use of "--std" flags.
So far, we've only got one header file that requires C99,
<util/atomic.h>. It uses C99 for-internal variable declarations.
The compiler-produced error message when attempting to use it in
non-C99 mode (e.g. when defaulting to "gnu89") looks like:
foo.c: In function ‘tmr’:
foo.c:7:3: error: ‘for’ loop initial declarations are only allowed in C99 mode
foo.c:7:3: note: use option -std=c99 or -std=gnu99 to compile your code
I think that's clear enough to not requiere any additional #ifdef'ed
warnings in our own header file.
--
cheers, J"org .-.-. --... ...-- -.. . DL8DTL
http://www.sax.de/~joerg/ NIC: JW11-RIPE
Never trust an operating system you don't have sources for. ;-)
- Re: [avr-libc-dev] [bug #36921] util/delay.h uses inline..., (continued)
- Re: [avr-libc-dev] [bug #36921] util/delay.h uses inline..., Joerg Wunsch, 2012/07/23
- Re: [avr-libc-dev] [bug #36921] util/delay.h uses inline..., Weddington, Eric, 2012/07/23
- Re: [avr-libc-dev] [bug #36921] util/delay.h uses inline..., Joerg Wunsch, 2012/07/23
- Re: [avr-libc-dev] [bug #36921] util/delay.h uses inline..., Weddington, Eric, 2012/07/23
- Re: [avr-libc-dev] [bug #36921] util/delay.h uses inline..., Joerg Wunsch, 2012/07/23
- Re: [avr-libc-dev] [bug #36921] util/delay.h uses inline..., Weddington, Eric, 2012/07/23
- Re: [avr-libc-dev] [bug #36921] util/delay.h uses inline..., Joerg Wunsch, 2012/07/23
- Re: [avr-libc-dev] [bug #36921] util/delay.h uses inline..., David Brown, 2012/07/24
- Re: [avr-libc-dev] [bug #36921] util/delay.h uses inline..., Weddington, Eric, 2012/07/24
- Re: [avr-libc-dev] [bug #36921] util/delay.h uses inline..., David Brown, 2012/07/24
- Re: [avr-libc-dev] [bug #36921] util/delay.h uses inline...,
Joerg Wunsch <=
- Re: [avr-libc-dev] [bug #36921] util/delay.h uses inline..., Weddington, Eric, 2012/07/24
- Re: [avr-libc-dev] [bug #36921] util/delay.h uses inline..., Georg-Johann Lay, 2012/07/24
- Re: [avr-libc-dev] [bug #36921] util/delay.h uses inline..., Joerg Wunsch, 2012/07/24
- Re: [avr-libc-dev] [bug #36921] util/delay.h uses inline..., David Brown, 2012/07/24
- Re: [avr-libc-dev] [bug #36921] util/delay.h uses inline..., Joerg Wunsch, 2012/07/25