/* Create a symbol table entry */
AddLocalSym (Decl.Ident, ParamTypeCvt (Decl.Type), Decl.StorageClass, 0);
+ /* If the parameter is a struct or union, emit a warning */
+ if (IsClassStruct (Decl.Type)) {
+ if (IS_Get (&WarnStructParam)) {
+ Warning ("Passing struct by value for parameter `%s'", Decl.Ident);
+ }
+ }
+
/* Count arguments */
++F->ParamCount;
/* Warning and error options */
IntStack WarnEnable = INTSTACK(1); /* Enable warnings */
IntStack WarningsAreErrors = INTSTACK(0); /* Treat warnings as errors */
+IntStack WarnStructParam = INTSTACK(1); /* Warn about structs passed by val */
IntStack WarnUnusedLabel = INTSTACK(1); /* Warn about unused labels */
IntStack WarnUnusedParam = INTSTACK(1); /* Warn about unused parameters */
IntStack WarnUnusedVar = INTSTACK(1); /* Warn about unused variables */
static WarnMapEntry WarnMap[] = {
/* Keep sorted, even if this isn't used for now */
{ &WarningsAreErrors, "error" },
+ { &WarnStructParam, "struct-param" },
{ &WarnUnknownPragma, "unknown-pragma" },
{ &WarnUnusedLabel, "unused-label" },
{ &WarnUnusedParam, "unused-param" },
/* Warning and error options */
extern IntStack WarnEnable; /* Enable warnings */
extern IntStack WarningsAreErrors; /* Treat warnings as errors */
+extern IntStack WarnStructParam; /* Warn about structs passed by val */
extern IntStack WarnUnusedLabel; /* Warn about unused labels */
extern IntStack WarnUnusedParam; /* Warn about unused parameters */
extern IntStack WarnUnusedVar; /* Warn about unused variables */