* Ruslan Yakovlev <qu...@bk.ru>, 20111028 17:45:
> nvenetlib.o:(.bss+0x0): multiple definition of `array'
> 
> tws_services.o:(.data+0x0): first defined here

Grrrr! $#(*@!&(*!@&#

I think you can work around this by removing either nve or tws.

I guess problems like these are mainly caused by the fact that we often
forget to mark global variables as static, even though they ought to be.
If only GCC/Clang had a warning for that...

-- 
 Ed Schouten <e...@80386.nl>
 WWW: http://80386.nl/
diff --git a/contrib/llvm/tools/clang/include/clang/Basic/DiagnosticSemaKinds.td b/contrib/llvm/tools/clang/include/clang/Basic/DiagnosticSemaKinds.td
index 97414f2..1306846 100644
--- a/contrib/llvm/tools/clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ b/contrib/llvm/tools/clang/include/clang/Basic/DiagnosticSemaKinds.td
@@ -2273,6 +2273,9 @@ def note_sentinel_here : Note<
 def warn_missing_prototype : Warning<
   "no previous prototype for function %0">,
   InGroup<DiagGroup<"missing-prototypes">>, DefaultIgnore;
+def warn_missing_variable_declaration : Warning<
+  "no previous extern declaration for non-static variable %0">,
+  InGroup<DiagGroup<"missing-variable-declaration">>, DefaultIgnore;
 def err_redefinition : Error<"redefinition of %0">;
 def err_definition_of_implicitly_declared_member : Error<
   "definition of implicitly declared %select{default constructor|copy "
diff --git a/contrib/llvm/tools/clang/lib/Sema/SemaDecl.cpp b/contrib/llvm/tools/clang/lib/Sema/SemaDecl.cpp
index 9d91a48..9a5fe21 100644
--- a/contrib/llvm/tools/clang/lib/Sema/SemaDecl.cpp
+++ b/contrib/llvm/tools/clang/lib/Sema/SemaDecl.cpp
@@ -4002,6 +4002,11 @@ void Sema::CheckVariableDeclaration(VarDecl *NewVD,
       Previous.addDecl(Pos->second);
   }
 
+  if (Previous.empty() && NewVD->getStorageClass() == SC_None &&
+      NewVD->hasGlobalStorage())
+    Diag(NewVD->getLocation(),
+      diag::warn_missing_variable_declaration) << NewVD;
+
   if (T->isVoidType() && !NewVD->hasExternalStorage()) {
     Diag(NewVD->getLocation(), diag::err_typecheck_decl_incomplete_type)
       << T;

Attachment: pgpn88f9sPMxm.pgp
Description: PGP signature

Reply via email to