• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 535
  • Last Modified:

what is this error about?

First time I saw a huge error like this and don't know what's causing it
codegen.h: In function âMakeTreeStmtâ:
codegen.h:10: error: storage class specified for parameter âtaNodeListâ
codegen.h:11: error: storage class specified for parameter âtaStringListâ
codegen.h:12: error: storage class specified for parameter âtaFuncListâ
codegen.h:21: error: storage class specified for parameter âdataStringGeneratedâ
codegen.h:22: error: storage class specified for parameter âregCountâ
In file included from intermediate.h:8,
                 from parse.y:13:
util.h:12: error: storage class specified for parameter âsym_tableâ
util.h:13: error: storage class specified for parameter âvarListâ
util.h:14: error: storage class specified for parameter âparamShouldBeConcatedâ
In file included from parse.y:13:
intermediate.h:14: error: redefinition of parameter âparamShouldBeConcatedâ
util.h:14: error: previous definition of âparamShouldBeConcatedâ was here
intermediate.h:19: error: storage class specified for parameter âtempcountâ
intermediate.h:20: error: storage class specified for parameter âtempCountEndsâ
intermediate.h:21: error: storage class specified for parameter âisArrayIndexâ
intermediate.h:22: error: storage class specified for parameter âbinopSeenâ
intermediate.h:23: error: storage class specified for parameter âifRelopExprStartâ
intermediate.h:24: error: storage class specified for parameter âfuncCallEndedâ
intermediate.h:25: error: storage class specified for parameter âvarTempNeededCheckâ
intermediate.h:26: error: storage class specified for parameter âisTaNodeStackEmptyâ
intermediate.h:27: error: storage class specified for parameter âlocalStrCountâ
intermediate.h:28: error: storage class specified for parameter âtempForCheckCountâ
In file included from parse.y:14:
symtab.h:9: error: storage class specified for parameter âGlobalDataTypeâ
symtab.h:9: error: storage class specified for parameter âGlobalParamTypeâ
symtab.h:10: error: storage class specified for parameter âGlobalFuncDefFlagâ
symtab.h:10: error: storage class specified for parameter âGlobalparamCountâ
symtab.h:11: error: storage class specified for parameter âGlobalFuncNameâ
symtab.h:12: error: storage class specified for parameter âglobalOffsetâ
symtab.h:13: error: storage class specified for parameter âlocalOffsetâ
symtab.h:14: error: storage class specified for parameter âlinenumberâ
symtab.h:15: error: storage class specified for parameter âsym_tableâ
symtab.h:15: error: redefinition of parameter âsym_tableâ
util.h:12: error: previous definition of âsym_tableâ was here
symtab.h:15: error: storage class specified for parameter âGlobalFuncDefPtrâ
symtab.h:16: error: storage class specified for parameter âvarListâ
symtab.h:16: error: redefinition of parameter âvarListâ
util.h:13: error: previous definition of âvarListâ was here
symtab.h:17: error: storage class specified for parameter âparamListâ
symtab.h:18: error: storage class specified for parameter âglobalParamOffsetâ
symtab.h:19: error: storage class specified for parameter âGlobalFuncArgTypesâ
symtab.h:20: error: storage class specified for parameter âfuncfoundâ
symtab.h:21: error: storage class specified for parameter âloopvarâ
symtab.h:22: error: storage class specified for parameter âparamShouldBeConcatedâ
symtab.h:22: error: redefinition of parameter âparamShouldBeConcatedâ
intermediate.h:14: error: previous definition of âparamShouldBeConcatedâ was here
parse.y:17: error: storage class specified for parameter âlinenumberâ
parse.y:17: error: redefinition of parameter âlinenumberâ
symtab.h:14: error: previous definition of âlinenumberâ was here
parse.y:18: error: storage class specified for parameter âyytextâ
parse.y:21: error: redefinition of parameter âsym_tableâ
symtab.h:15: error: previous definition of âsym_tableâ was here
parse.y:21: error: redefinition of parameter âGlobalFuncDefPtrâ
symtab.h:15: error: previous definition of âGlobalFuncDefPtrâ was here
parse.y:22: error: redefinition of parameter âvarListâ
symtab.h:16: error: previous definition of âvarListâ was here
parse.y:24: error: redefinition of parameter âGlobalFuncNameâ
symtab.h:11: error: previous definition of âGlobalFuncNameâ was here
parse.y:25: error: redefinition of parameter âparamListâ
symtab.h:17: error: previous definition of âparamListâ was here
parse.y:27: error: redefinition of parameter âGlobalparamCountâ
symtab.h:10: error: previous definition of âGlobalparamCountâ was here
parse.y:27: error: redefinition of parameter âloopvarâ
symtab.h:21: error: previous definition of âloopvarâ was here
parse.y:27: error: parameter âGlobalFuncDefFlagâ is initialized
parse.y:27: error: redefinition of parameter âGlobalFuncDefFlagâ
symtab.h:10: error: previous definition of âGlobalFuncDefFlagâ was here
parse.y:28: error: redefinition of parameter âfuncfoundâ
symtab.h:20: error: previous definition of âfuncfoundâ was here
parse.y:28: error: redefinition of parameter âGlobalFuncArgTypesâ
symtab.h:19: error: previous definition of âGlobalFuncArgTypesâ was here
parse.y:28: error: parameter âreturnSeenâ is initialized
parse.y:28: error: parameter âglobalOffsetâ is initialized
parse.y:28: error: redefinition of parameter âglobalOffsetâ
symtab.h:12: error: previous definition of âglobalOffsetâ was here
parse.y:28: error: parameter âlocalOffsetâ is initialized
parse.y:28: error: redefinition of parameter âlocalOffsetâ
symtab.h:13: error: previous definition of âlocalOffsetâ was here
parse.y:29: error: parameter âglobalParamOffsetâ is initialized
parse.y:29: error: redefinition of parameter âglobalParamOffsetâ
symtab.h:18: error: previous definition of âglobalParamOffsetâ was here
parse.y:29: error: parameter âtempcountâ is initialized
parse.y:29: error: redefinition of parameter âtempcountâ
intermediate.h:19: error: previous definition of âtempcountâ was here
parse.y:29: error: parameter âtempCountEndsâ is initialized
parse.y:29: error: redefinition of parameter âtempCountEndsâ
intermediate.h:20: error: previous definition of âtempCountEndsâ was here
parse.y:29: error: parameter âfuncCallEndedâ is initialized
parse.y:29: error: redefinition of parameter âfuncCallEndedâ
intermediate.h:24: error: previous definition of âfuncCallEndedâ was here
parse.y:29: error: parameter âlocalStrCountâ is initialized
parse.y:29: error: redefinition of parameter âlocalStrCountâ
intermediate.h:27: error: previous definition of âlocalStrCountâ was here
parse.y:29: error: parameter âbinopSeenâ is initialized
parse.y:29: error: redefinition of parameter âbinopSeenâ
intermediate.h:22: error: previous definition of âbinopSeenâ was here
parse.y:29: error: parameter âifRelopExprStartâ is initialized
parse.y:29: error: redefinition of parameter âifRelopExprStartâ
intermediate.h:23: error: previous definition of âifRelopExprStartâ was here
parse.y:29: error: parameter âisArrayIndexâ is initialized
parse.y:29: error: redefinition of parameter âisArrayIndexâ
intermediate.h:21: error: previous definition of âisArrayIndexâ was here
parse.y:29: error: parameter âtempForCheckCountâ is initialized
parse.y:29: error: redefinition of parameter âtempForCheckCountâ
intermediate.h:28: error: previous definition of âtempForCheckCountâ was here
parse.y:30: error: parameter âvarTempNeededCheckâ is initialized
parse.y:30: error: redefinition of parameter âvarTempNeededCheckâ
intermediate.h:25: error: previous definition of âvarTempNeededCheckâ was here
parse.y:30: error: parameter âisTaNodeStackEmptyâ is initialized
parse.y:30: error: redefinition of parameter âisTaNodeStackEmptyâ
intermediate.h:26: error: previous definition of âisTaNodeStackEmptyâ was here
parse.y:33: error: parameter âdataStringGeneratedâ is initialized
parse.y:33: error: redefinition of parameter âdataStringGeneratedâ
codegen.h:21: error: previous definition of âdataStringGeneratedâ was here
parse.y:34: error: parameter âregCountâ is initialized
parse.y:34: error: redefinition of parameter âregCountâ
codegen.h:22: error: previous definition of âregCountâ was here
parse.y:39: error: redefinition of parameter âGlobalDataTypeâ
symtab.h:9: error: previous definition of âGlobalDataTypeâ was here
parse.y:39: error: redefinition of parameter âGlobalParamTypeâ
symtab.h:9: error: previous definition of âGlobalParamTypeâ was here
parse.y:42: error: parameter âforStringsâ is initialized
parse.y:44: error: redefinition of parameter âtaNodeListâ
codegen.h:10: error: previous definition of âtaNodeListâ was here
parse.y:44: error: redefinition of parameter âtaStringListâ
codegen.h:11: error: previous definition of âtaStringListâ was here
parse.y:44: error: redefinition of parameter âtaFuncListâ
codegen.h:12: error: previous definition of âtaFuncListâ was here
parse.y:65: error: storage class specified for parameter âYYSTYPEâ
y.tab.c:109: error: parameter âyylhsâ is initialized
y.tab.c:109: warning: initialization makes pointer from integer without a cast
y.tab.c:110: warning: excess elements in scalar initializer
y.tab.c:110: warning: (near initialization for âyylhsâ)
y.tab.c:110: warning: excess elements in scalar initializer
y.tab.c:110: warning: (near initialization for âyylhsâ)
y.tab.c:110: warning: excess elements in scalar initializer
y.tab.c:110: warning: (near initialization for âyylhsâ)
y.tab.c:110: warning: excess elements in scalar initializer
y.tab.c:110: warning: (near initialization for âyylhsâ)
y.tab.c:110: warning: excess elements in scalar initializer
y.tab.c:110: warning: (near initialization for âyylhsâ)
y.tab.c:110: warning: excess elements in scalar initializer
y.tab.c:110: warning: (near initialization for âyylhsâ)
y.tab.c:110: warning: excess elements in scalar initializer
y.tab.c:110: warning: (near initialization for âyylhsâ)
y.tab.c:110: warning: excess elements in scalar initializer
y.tab.c:110: warning: (near initialization for âyylhsâ)
y.tab.c:110: warning: excess elements in scalar initializer
y.tab.c:110: warning: (near initialization for âyylhsâ)
y.tab.c:110: warning: excess elements in scalar initializer
y.tab.c:110: warning: (near initialization for âyylhsâ)
y.tab.c:111: warning: excess elements in scalar initializer
y.tab.c:111: warning: (near initialization for âyylhsâ)
y.tab.c:111: warning: excess elements in scalar initializer
y.tab.c:111: warning: (near initialization for âyylhsâ)
y.tab.c:111: warning: excess elements in scalar initializer
y.tab.c:111: warning: (near initialization for âyylhsâ)
y.tab.c:111: warning: excess elements in scalar initializer
y.tab.c:111: warning: (near initialization for âyylhsâ)
y.tab.c:111: warning: excess elements in scalar initializer
y.tab.c:111: warning: (near initialization for âyylhsâ)
y.tab.c:111: warning: excess elements in scalar initializer
y.tab.c:111: warning: (near initialization for âyylhsâ)
y.tab.c:111: warning: excess elements in scalar initializer
y.tab.c:111: warning: (near initialization for âyylhsâ)
y.tab.c:111: warning: excess elements in scalar initializer
y.tab.c:111: warning: (near initialization for âyylhsâ)
y.tab.c:111: warning: excess elements in scalar initializer
y.tab.c:111: warning: (near initialization for âyylhsâ)
y.tab.c:111: warning: excess elements in scalar initializer
y.tab.c:111: warning: (near initialization for âyylhsâ)
y.tab.c:112: warning: excess elements in scalar initializer
y.tab.c:112: warning: (near initialization for âyylhsâ)
y.tab.c:112: warning: excess elements in scalar initializer
y.tab.c:112: warning: (near initialization for âyylhsâ)
y.tab.c:112: warning: excess elements in scalar initializer
y.tab.c:112: warning: (near initialization for âyylhsâ)
y.tab.c:112: warning: excess elements in scalar initializer
y.tab.c:112: warning: (near initialization for âyylhsâ)
y.tab.c:112: warning: excess elements in scalar initializer
y.tab.c:112: warning: (near initialization for âyylhsâ)
y.tab.c:112: warning: excess elements in scalar initializer
y.tab.c:112: warning: (near initialization for âyylhsâ)
y.tab.c:112: warning: excess elements in scalar initializer
y.tab.c:112: warning: (near initialization for âyylhsâ)
y.tab.c:112: warning: excess elements in scalar initializer
y.tab.c:112: warning: (near initialization for âyylhsâ)
y.tab.c:112: warning: excess elements in scalar initializer
y.tab.c:112: warning: (near initialization for âyylhsâ)
y.tab.c:112: warning: excess elements in scalar initializer
y.tab.c:112: warning: (near initialization for âyylhsâ)
y.tab.c:113: warning: excess elements in scalar initializer

Open in new window

0
kuntilanak
Asked:
kuntilanak
  • 20
  • 8
  • 7
  • +1
2 Solutions
 
kuntilanakAuthor Commented:
one thing I found out is because in one of the .h file I have:

extern struct symEntry *sym_table

and in an other file I also have

extern struct symEntry *sym_table

the real sym_table is declared in a .c file.. so how would I solve this?
0
 
sunnycoderCommented:
>codegen.h:10: error: storage class specified for parameter âtaNodeListâ
sounds like you have something like fun(static Node * NodeList); or may be you used extern/register etc specified for parameter. Or you messed up a typedef declaration. Missing ; or { or } ?

Would help if you could post some code.
0
 
sunnycoderCommented:
What you posted is indeed the usage of extern ... declare at multiple places define at one.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
kuntilanakAuthor Commented:
yes, that's true.. here's my codegen.h
#ifndef codegen_h
#define codegen_h
 
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "threeaddress.h"
 
void listTAnodes( TA_NODE *);
extern TA_NODE *taNodeList;
extern TA_NODE *taStringList;
extern TA_NODE *taFuncList;
 
TA_NODE *taNodeListNew;
 
/* list of variables */
int EnterValDivBy4(int );
char *asmString;
char binopString[20], relopString[20];
int presentFuncEnterVal1,presentFuncEnterVal2,globalTaParamCount, binopCode, relopCode;
 
extern int dataStringGenerated;
extern int regCount;
 
/* list of functions */
void genAsmCode();
void asmGenerate( TA_NODE *);
void asmForBinop( TA_NODE * );
void asmForRelop( TA_NODE * );
void asmBinopCode(int);
 
void addPrintMethod(void);
 
#endif

Open in new window

0
 
sunnycoderCommented:
#include "threeaddress.h"

Can you post contents of this file?
0
 
kuntilanakAuthor Commented:
can't we upload a zip file here? I've zipped all the file but it says :

The extension of one or more files in the archive is not in the list of allowed extensions: temp/codegen.c
0
 
sunnycoderCommented:
post it on ee-stuff.com ... Also I wont need the entire code ... only the file I requested.
0
 
kuntilanakAuthor Commented:
0
 
kuntilanakAuthor Commented:
I have given you all the code as the error propagates everywhere...
0
 
sunnycoderCommented:
I cant see anything obviously wrong with relevant code ... Are these errors on top of the error list? Do you have a makefile for this code?
0
 
kuntilanakAuthor Commented:
all the file is on that zip file and the Makefile is in there if you look at it
0
 
sunnycoderCommented:
my bad .. it is there indeed

parse.y:8:21: error: globals.h: No such file or directory
are we missing a file?
0
 
kuntilanakAuthor Commented:
oops..here it is:


#ifndef globals_h
#define globals_h
 
#define INTArrayType 1
#define CHARArrayType 2
#define STRINGType 3
#define INTEGERType 4
#define CHARACTERType 5
#define VOIDType 6
 
 
#define TRUE 1
#define FALSE 0
 
enum DataTypes
{
   INTARRTYPE=1,
   CHARARRTYPE,
   STRTYPE,
   INTTYPE,
   CHARTYPE,
   VOIDTYPE
};
 
 
enum EntryType
{
   VARIABLE = 1 ,
   FUNC,
   FUNCDEF,
   EXTERNFUNC
};
 
struct Type
{
   enum DataTypes whichType ;
   int arrayBound ;
};
 
struct symEntry 
{
   char *idName ;
   enum EntryType entryType;
   struct Type type ;
   enum DataTypes retType ;
   int noOfParams ;
   int offset;
   int scope;
   enum DataTypes parameterTypes[50] ;
   char *paramLabel[50] ;
   int paramOffset[50];
   struct symEntry *functablebranch ;
   struct symEntry *next;
};
 
struct allVarList
{
  char *varName;
  char *fnName;
  int varOffset;
  int varScope;
  int varType;
  int arrayLimit;
  int isParam;
  struct allVarList *nextVar;
 };
 
#endif

Open in new window

0
 
sunnycoderCommented:
codegen.h: In function âMakeTreeStmtâ:
codegen.h:10: error: storage class specified for parameter âtaNodeListâ

There is no function MakeTreeStmt iin codegen.h ... The C code looks ok ...
I am not familiar with lexx and yacc ... Seems like I am missing something there.
0
 
Kent OlsenData Warehouse Architect / DBACommented:
Hi Kuntilanak,

The error "storage class specified for parameter" usually comes about because of a small typographical error.  You've dropped a semicolon (statement terminator) or right parenthesis (encapsulator) is a spot where the language would let you end the statement or grouping, or continue with the statement.

Your code:

#ifndef codegen_h
#define codegen_h
 
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "threeaddress.h"
 
void listTAnodes( TA_NODE *);
extern TA_NODE *taNodeList;

generates an error at line 10 (the last line posted above).  I expect that the listTAnodes prototype is being compiled into the last statement in "threeaddress.h".  After that, all bets are off.  :)

Starting at the bottom and working up, check threeaddress.h and make sure that the definitions contain semicolons, right parenthesis, right brackets, and right braces where they should be.  If it looks right to you, go ahead and post the source to threeaddress.h and we'll help look it over.


Good Luck,
Kent
0
 
kuntilanakAuthor Commented:
yes, everything looks right for me.. can you please help me out..
0
 
Kent OlsenData Warehouse Architect / DBACommented:


>> If it looks right to you, go ahead and post the source to threeaddress.h and we'll help look it over.
0
 
kuntilanakAuthor Commented:
I've already post the whole code above.. it's a link
0
 
kuntilanakAuthor Commented:
I don't know if this is true or not.. but is it because that I declared extern TA_NODE *taNodeList; in a file that I did not include in here? I don't think it matters as everything will be linked together in the end
0
 
Kent OlsenData Warehouse Architect / DBACommented:
Ok.  We're getting somewhere.

You're trying to compile parse.y.  Notice line 49 in your original snippet.

parse.y is not a c file.  The '%' character scattered through the source code suggests that this file needs to be passed through a preprocessor (lex/yacc/etc.) to generate a C file.  

How did you create this file and what are your plans for it?


Kent
0
 
kuntilanakAuthor Commented:
parse.y is compiled using bison to produce y.tab.c file.. so should I just move all variables in the parse.y file to globals.h file?
0
 
Kent OlsenData Warehouse Architect / DBACommented:
There are a couple of things at work here.  Since parse.y needs to be processed through bison, why (and how) is it getting passed to the C compiler for processing?  That's an error with far-reaching effects, quite possibly including the "storage class specified...." error.

Only C source code can be compiled with the C compiler.

There will be some compilation errors even after this gets resolved.  But those are more normal events.  The initialization of taNodeList, taStringList and taFuncList are illegal.  We'll know that the source code issue is resolved when we see those errors at the top of the list.


Kent
0
 
kuntilanakAuthor Commented:
parse.y needs to be processed through bison/yacc so we can generate a .c file for it which is called y.tab.c and that's a C source code..
0
 
Kent OlsenData Warehouse Architect / DBACommented:
That's fine.

Pass parse.y thour bison/yacc, but don't pass the parse.y file to the C compiler.  pass y.tab.c.

Are you using a make file, your own script, or calling the commands by hand?


0
 
kuntilanakAuthor Commented:
I am using a makefile and the makefile is included in the file you donwload.. If you look there I am not passing parse.y to the C compiler.. I am passing the y.tab.c file
0
 
Infinity08Commented:
>> why (and how) is it getting passed to the C compiler for processing?

Kdo, it's not. The error messages are shown for the .y file for convenience only (by using #line's), but it is the actual .c file that is compiled.




in syntaxtree.h, the last function prototype is missing the ; at the end.
0
 
kuntilanakAuthor Commented:
lol.. that one semicolon sure cause tons of problem.. if works fine now.. thanks for your catchy eye infinity
0
 
kuntilanakAuthor Commented:
oh and just one more thing, say I have to declare variables:

char paramStr[1000], assignVarCode[500],assignArrCode[500], forArrayAssign[500];

usually do people put it in the .h file or the .c file?? and if I want to assign

int a = 0;

I can't do that in the .c file right?
0
 
Infinity08Commented:
A .h file is included in one or more .c files (eventually), so it's not the place to put data definitions, since that might cause multiple definition errors.

A header file should just contain the interface (function prototypes, type definitions, externs, etc.). The actual implementation belongs in the .c files.
0
 
kuntilanakAuthor Commented:
ok.. so it's better to put declaration inside the .c file?

although on top of the .h file I already defined if_def blah.h
0
 
Infinity08Commented:
>> although on top of the .h file I already defined if_def blah.h

the header guard only avoids that the same header file is included more than once in the same .c file. It does not avoid that the header file is included in multiple .c files.
0
 
Kent OlsenData Warehouse Architect / DBACommented:
>> in syntaxtree.h, the last function prototype is missing the ; at the end.

Good Catch, Infinity.

I definitely need to get my eyes checked.  Told him it what to look for and where, and still didn't see it.   :)


0
 
Infinity08Commented:
Heh, I had to look for a while too lol.
0
 
kuntilanakAuthor Commented:
I guess my eyes and Kdo aren't so good at catching semicolon.. I appreciate the effort as well Kdo
0
 
kuntilanakAuthor Commented:
and extern declarations also should be at .h files right?
0
 
Infinity08Commented:
>> and extern declarations also should be at .h files right?

could. Where they are depends on how they are used.
0
 
kuntilanakAuthor Commented:
and if I have:

char *idList[100];

and I want to refer back again to that:

should I do:

extern char *idList[100];

or

extern char *idList[1];
0
 
Infinity08Commented:
You need to use the exact same declaration.
0
 
kuntilanakAuthor Commented:
ok.. so this: extern char *idList[100];
0
 
Infinity08Commented:
Yes.
0
 
Kent OlsenData Warehouse Architect / DBACommented:

>>  ... The error messages are shown for the .y file for convenience only (by using #line's), but it is the actual .c file that is compiled.

Is that what #line is for?  I'd never seen one before now.  Good to know....


Kent
0
 
Infinity08Commented:
>> Is that what #line is for?

It basically maps lines of generated code to to their corresponding lines in the original source file. That way, when the generated code has a problem, the actual location of the problem in the original source file can easily be found.

It's quite handy, but only really useful in generated code.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 20
  • 8
  • 7
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now