Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 28 Oct 2011 21:59:17 +0200
From:      Ed Schouten <ed@80386.nl>
To:        Ruslan Yakovlev <quazi@bk.ru>
Cc:        freebsd-current@freebsd.org
Subject:   Re: FreeBSD 9.0 BETA1 build kernel
Message-ID:  <20111028195917.GA63910@hoeg.nl>
In-Reply-To: <4EAACE0D.1040702@bk.ru>
References:  <4EAACE0D.1040702@bk.ru>

next in thread | previous in thread | raw e-mail | index | archive | help

--Oh6wehMCKJhhoxlo
Content-Type: multipart/mixed; boundary="/w6WUUxYkubDgwa5"
Content-Disposition: inline


--/w6WUUxYkubDgwa5
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

* Ruslan Yakovlev <quazi@bk.ru>, 20111028 17:45:
> nvenetlib.o:(.bss+0x0): multiple definition of `array'
>=20
> 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...

--=20
 Ed Schouten <ed@80386.nl>
 WWW: http://80386.nl/

--/w6WUUxYkubDgwa5
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment; filename="missing-variable-declaration.diff"
Content-Transfer-Encoding: quoted-printable

diff --git a/contrib/llvm/tools/clang/include/clang/Basic/DiagnosticSemaKin=
ds.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);
   }
=20
+  if (Previous.empty() && NewVD->getStorageClass() =3D=3D 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;

--/w6WUUxYkubDgwa5--

--Oh6wehMCKJhhoxlo
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (FreeBSD)

iQIcBAEBAgAGBQJOqwmVAAoJEG5e2P40kaK7aZwP/i7QAwz17bQQp8LSph8elX1D
Ko7GjTt8mUi0qBKvKLRGblSGn5IWCJdbM6+++IjSPNtpxmp32nsb6sjM7I1tWoUC
x/f6ThH+/hZcKDg3yUa6mrlGZTkBQGCnIcbmV1zsIRVSbqoAIgan7cuRBqIAezr2
PGpT4ASRWiCAjDF6/11GeaVed3QStNP1mtHya+UP7CUcAREUoQcXLDJm32xZNj7N
1vRvYbR2AxcdISnse89peJaAIr+8vx113AjzZQhj4BhmnkJGvuaDo4jeIVutedlk
wCVcaLNh/XPcvXWRZJ4VLFpimUU3qen4m6VxoAGNi4plPi6sEtl1ab7JyyqT/41M
ptwmr2z/BKpAAF9VZkLFNzQM7KNyKqi+Tk6rXruBnSie8Lir+qmEWK1shTo/cSTx
RTXP7OuUXQritTD26TugrJyyvjVu7ISdaJMtenTC/pjNhCu648pIIYUcY94z31Rw
24ZZ1uc4Vd5Dm8FLUuScM9FdfjYjZNO36SzN989hPXVmZh2drvwG2VP4ShKVCrzL
7lMJf2bnAG2sRFjApSu63x6/tkSrv/0coCTfHNExQhyC/KPZPknhFFh8XFqyeH4T
6hgohx8sBCsidtnSMOADzutspU0rMMg/aSq4yhCpEmgWVTwc36/D05omJJIe4hnF
WnGnj7Yk/3muvRDFKkrf
=U5qU
-----END PGP SIGNATURE-----

--Oh6wehMCKJhhoxlo--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20111028195917.GA63910>