Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0000111 [cparser] parser minor always 2013-08-01 10:46 2016-01-03 03:28
Reporter luzero View Status public  
Assigned To Matze
Priority normal Resolution not fixable  
Status closed   Product Version
Summary 0000111: Spurious warning on valid code
Description /usr/src/cparser/build/debug/cparser -Wmissing-declarations -m32 -std=c99 -pthread -g -c -o out.o /tmp/000.c
/tmp/000.c:7:5: warning: no previous declaration for 'Foo foo' [-Wmissing-declarations]
Additional Information cparser: e038ad4
libfirm: 6cba223
Tags No tags attached.
Attached Files c file icon 000.c [^] (68 bytes) 2013-08-01 10:46

- Relationships

-  Notes
(0000160)
Matze (administrator)
2013-08-01 23:29
edited on: 2013-08-01 23:32

This is expected behaviour. The idea here is that in a nice program you either:
- Have a global variable in a single compilation unit only, in this case it should have static storage class.
- If the variable is meant to be used in multiple compilation units then it should have been declared in a header (with extern storage) class and that header should have been included earlier.
These rules are a bit confusing as in the C language a global variable without initializer and normal storage class serves as both a declaration and a definition, so we can't emit sensible warnings in this case.

So either marking the "foo" variable static or adding an extern declaration of it before will silence this warning. We're also open to suggestions if there is a formulation of this warning that is easier to understand.


- Issue History
Date Modified Username Field Change
2013-08-01 10:46 luzero New Issue
2013-08-01 10:46 luzero File Added: 000.c
2013-08-01 23:29 Matze Note Added: 0000160
2013-08-01 23:29 Matze Assigned To => Matze
2013-08-01 23:29 Matze Status new => resolved
2013-08-01 23:29 Matze Resolution open => not fixable
2013-08-01 23:32 Matze Note Edited: 0000160
2016-01-03 03:28 Matze Status resolved => closed


Mantis 1.1.5[^]
Copyright © 2000 - 2008 Mantis Group
Powered by Mantis Bugtracker