Multiple small fixes for better C conformance.

Allow atomic types to be initialized with single-element expression lists:
  int x = { 5 };
Issue an error if a storage class is provided with a function parameter.
Issue an error if two members of a struct have the same name.
Issue an error on trying to assign to a struct with a const member, even if
  the struct itself isn't const.
Issue an error if a function is redefined.
Issue an error if a function overload is declared that differs only in return
  type from a previously-declared function.
Issue an error if "inline" or "task" qualifiers are used outside of function
  declarations.
Allow trailing ',' at the end of enumerator lists.
Multiple tests for all of the above.
This commit is contained in:
Matt Pharr
2011-11-25 17:52:23 -08:00
parent 975db80ef6
commit 867efc2bce
20 changed files with 218 additions and 94 deletions

View File

@@ -339,6 +339,13 @@ Function::GenerateIR() {
llvm::Function *function = sym->function;
assert(function != NULL);
// But if that function has a definition, we don't want to redefine it.
if (function->empty() == false) {
Error(sym->pos, "Ignoring redefinition of function \"%s\".",
sym->name.c_str());
return;
}
// Figure out a reasonable source file position for the start of the
// function body. If possible, get the position of the first actual
// non-StmtList statment...