From owner-freebsd-current@FreeBSD.ORG Fri Oct 28 19:59:18 2011 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C17FB106566B for ; Fri, 28 Oct 2011 19:59:18 +0000 (UTC) (envelope-from ed@hoeg.nl) Received: from mx0.hoeg.nl (mx0.hoeg.nl [IPv6:2a01:4f8:101:5343::aa]) by mx1.freebsd.org (Postfix) with ESMTP id 5C8C78FC14 for ; Fri, 28 Oct 2011 19:59:18 +0000 (UTC) Received: by mx0.hoeg.nl (Postfix, from userid 1000) id BD9C42A28CC3; Fri, 28 Oct 2011 21:59:17 +0200 (CEST) Date: Fri, 28 Oct 2011 21:59:17 +0200 From: Ed Schouten To: Ruslan Yakovlev Message-ID: <20111028195917.GA63910@hoeg.nl> References: <4EAACE0D.1040702@bk.ru> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="Oh6wehMCKJhhoxlo" Content-Disposition: inline In-Reply-To: <4EAACE0D.1040702@bk.ru> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: freebsd-current@freebsd.org Subject: Re: FreeBSD 9.0 BETA1 build kernel X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Oct 2011 19:59:18 -0000 --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 , 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 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>, DefaultIgnore; +def warn_missing_variable_declaration : Warning< + "no previous extern declaration for non-static variable %0">, + InGroup>, 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--