bug in avr-gcc (WinAVR User Manual - 20050214)?

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

Threaded View
I just managed to compile and build a 'c' file with this at the end of a
function:

void myfunction(void){

    ... stuff


    // test: end of initialisation.
    u08 uart_putchar(u08 c);  // no warnings or errors given here.

}

Any comments?




Re: bug in avr-gcc (WinAVR User Manual - 20050214)?
Quoted text here. Click to load it

Comments:
1) Don't say bug, it won't make you any friends around here.
2) Did you switch on all warnings?  -Wall
3) What assembler does it generate?

Peter



Re: bug in avr-gcc (WinAVR User Manual - 20050214)?
Did I say, "bug"?  I meant to say, "perceived non-conformance with expected
behaviour" ;-)

I looked at the .lst file that was generated and it seems to be the same
even if it has the 'rouge' line in it - so, it's silently dropped (on my
setup), even though I'd never be able to get something like this past MS
Developer Studio.

yes, -Wall is on, but I may not be getting any warnings (my development
environment is a bit broken) - it was inherited, but I've 'upgraded' to
support a newer Atmel Processor (ATmega8535) and something's not quite
right - I can build to the point where I get the flash hex file that can
successfully be downloaded and confirmed as working on the hardware, but the
make file (avr_freaks version) bombs out somewhere after step 8  (I changed
the format from 'avrobj' to 'coff-avr' (sort of at random) to get it past
stage 8).

The only reason that even got this far was by using a file monitor to see
what gcc, et al. files were coming up as 'not found' during the build - is
gcc always this hard on the user?

(From my experience if IAR Workbench on a previous project, I'd easily pay
the money for that (if it could be budgeted) rather than have all this
hassle with gcc.)

Thanks.


Quoted text here. Click to load it



Re: bug in avr-gcc (WinAVR User Manual - 20050214)?

Quoted text here. Click to load it
easily pay
this

cost of IAR merely for a guarantee I would never have to use it (IAR)
ever again. Bugs, oddities, HUGE COSTS every time you discover a bug,
dongle protection, HUGE COSTS for upgrades that should be free to fix
bugs, ineffectual tech support, and did I mention HUGE COSTS every time
you report a bug and request what ought to be a free fix for
noncompliance with advertised capabilities?

gcc delivers exactly what it promises, for the advertised price.


Re: bug in avr-gcc (WinAVR User Manual - 20050214)?
On Sat, 12 Mar 2005 14:59:58 -0000, "Joe"
comp.arch.embedded:

Quoted text here. Click to load it

What version of gcc is involved?  And what is "... stuff"?

Even assuming that "... stuff" contains executable statements, the
last line is a function prototype declaration.  Prior to the 1999
version of the C language standard, declarations are not allowed after
executable statements in a block.  But since 1999 they are, so the
code is quite legal if you are compiling with the current C standard.

--
Jack Klein
Home: http://JK-Technology.Com
We've slightly trimmed the long signature. Click to see the full one.
Re: bug in avr-gcc (WinAVR User Manual - 20050214)?
Quoted text here. Click to load it

Okay, that explains it - I'm just behind the times.

Why would someone want to put a function prototype at the end of a function
like this (I suppose it's to reduce the scope of the prototype - but it
seems clumsy - it's certanly not elegant.).

Thanks.



Re: bug in avr-gcc (WinAVR User Manual - 20050214)?
On Sat, 12 Mar 2005 20:48:51 -0000, "Joe"

Quoted text here. Click to load it

There was a bit of discussion regarding this on the avr-gcc list I
think. It was mentioned that this functions within functions support
by gcc could be very usefull if one had to port a large pascal
application to C.

Regards
   Anton Erasmus



Re: bug in avr-gcc (WinAVR User Manual - 20050214)?

Quoted text here. Click to load it

... except that nested functions is not what the case at hand is
about.

It's about a function *declaration* found inside some other functions.
That's bad style, you should generally never do that, but it's
allowed.  And as of C99, it's even allowed anywhere inside an
statement block, instead of only in its beginning.

--
Hans-Bernhard Broeker ( snipped-for-privacy@physik.rwth-aachen.de)
Even if all the snow were burnt, ashes would remain.

Re: bug in avr-gcc (WinAVR User Manual - 20050214)?
Quoted text here. Click to load it

I think it is the wrong question.
The standard allows prototypes (and AFAIK variable declarations)
anywhere in the function.
The compiler cares (not much) about sense and nonsense of what the
programmer writes.
--
42Bastian
Do not email to snipped-for-privacy@yahoo.com, it's a spam-only account :-)
We've slightly trimmed the long signature. Click to see the full one.

Site Timeline