office-gobmx/compilerplugins/clang
Stephan Bergmann f853ec317f Extend loplugin:external to warn about classes
...following up on 314f15bff0 "Extend
loplugin:external to warn about enums".

Cases where free functions were moved into an unnamed namespace along with a
class, to not break ADL, are in:

  filter/source/svg/svgexport.cxx
  sc/source/filter/excel/xelink.cxx
  sc/source/filter/excel/xilink.cxx
  svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx

All other free functions mentioning moved classes appear to be harmless and not
give rise to (silent, even) ADL breakage.  (One remaining TODO in
compilerplugins/clang/external.cxx is that derived classes are not covered by
computeAffectedTypes, even though they could also be affected by ADL-breakage---
but don't seem to be in any acutal case across the code base.)

For friend declarations using elaborate type specifiers, like

  class C1 {};
  class C2 { friend class C1; };

* If C2 (but not C1) is moved into an unnamed namespace, the friend declaration
must be changed to not use an elaborate type specifier (i.e., "friend C1;"; see
C++17 [namespace.memdef]/3: "If the name in a friend declaration is neither
qualified nor a template-id and the declaration is a function or an
elaborated-type-specifier, the lookup to determine whether the entity has been
previously declared shall not consider any scopes outside the innermost
enclosing namespace.")

* If C1 (but not C2) is moved into an unnamed namespace, the friend declaration
must be changed too, see <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71882>
"elaborated-type-specifier friend not looked up in unnamed namespace".

Apart from that, to keep changes simple and mostly mechanical (which should help
avoid regressions), out-of-line definitions of class members have been left in
the enclosing (named) namespace.  But explicit specializations of class
templates had to be moved into the unnamed namespace to appease
<https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92598> "explicit specialization of
template from unnamed namespace using unqualified-id in enclosing namespace".

Also, accompanying declarations (of e.g. typedefs or static variables) that
could arguably be moved into the unnamed namespace too have been left alone.

And in some cases, mention of affected types in blacklists in other loplugins
needed to be adapted.

And sc/qa/unit/mark_test.cxx uses a hack of including other .cxx, one of which
is sc/source/core/data/segmenttree.cxx where e.g. ScFlatUInt16SegmentsImpl is
not moved into an unnamed namespace (because it is declared in
sc/inc/segmenttree.hxx), but its base ScFlatSegmentsImpl is.  GCC warns about
such combinations with enabled-by-default -Wsubobject-linkage, but "The compiler
doesn’t give this warning for types defined in the main .C file, as those are
unlikely to have multiple definitions."
(<https://gcc.gnu.org/onlinedocs/gcc-9.2.0/gcc/Warning-Options.html>)  The
warned-about classes also don't have multiple definitions in the given test, so
disable the warning when including the .cxx.

Change-Id: Ib694094c0d8168be68f8fe90dfd0acbb66a3f1e4
Reviewed-on: https://gerrit.libreoffice.org/83239
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-11-22 12:57:32 +01:00
..
sharedvisitor compilerplugins: fix ambiguous type warnings 2019-11-18 13:56:08 +01:00
store
test Extend loplugin:external to warn about classes 2019-11-22 12:57:32 +01:00
automem.cxx
badstatics.cxx Extend loplugin:external to warn about classes 2019-11-22 12:57:32 +01:00
blockblock.cxx
bufferadd.cxx Fix call to NamedDecl::getName 2019-10-23 22:07:32 +02:00
buriedassign.cxx
casttovoid.cxx
changetoolsgen.cxx
charrightshift.cxx
check.cxx
check.hxx
checkconfigmacros.cxx
checkunusedparams.cxx
classmemaccess.cxx
collapseif.cxx
commaoperator.cxx
comparisonwithconstant.cxx
compat.hxx
conditionalstring.cxx New loplugin:conditionalstring 2019-11-02 21:47:38 +01:00
constantparam.bitmask.results
constantparam.booleans.results
constantparam.constructors.results
constantparam.cxx Make base of loplugin::FunctionAddress more flexible 2019-11-11 17:29:06 +01:00
constantparam.numbers.results
constantparam.py
constfields.cxx
constfields.py
constfieldsrewrite.cxx
constmethod.cxx Make base of loplugin::FunctionAddress more flexible 2019-11-11 17:29:06 +01:00
constparams.cxx Make base of loplugin::FunctionAddress more flexible 2019-11-11 17:29:06 +01:00
conststringvar.cxx
consttobool.cxx Missing includes 2019-11-18 17:29:17 +01:00
constvars.cxx
convertlong.cxx
countusersofdefaultparams.cxx
countusersofdefaultparams.py
cppunitassertequals.cxx
cstylecast.cxx
data.cxx
datamembershadow.cxx
dbgunhandledexception.cxx
derefnullptr.cxx
dllprivate.cxx
dodgyswitch.cxx
doubleconvert.cxx
duplicate-defines.cxx Fix loplugin::Entry ODR violation 2019-11-16 16:48:33 +01:00
dyncastvisibility.cxx
dynexcspec.cxx
empty.cxx
emptyif.cxx
expandablemethods.cxx
expandablemethods.py
expressionalwayszero.cxx
external.cxx Extend loplugin:external to warn about classes 2019-11-22 12:57:32 +01:00
externandnotdefined.cxx
externvar.cxx
faileddyncast.cxx
fakebool.cxx Fix loplugin:fakebool (clang-cl) 2019-11-19 21:34:45 +01:00
finalclasses.cxx loplugin:finalclasses fix check 2019-10-29 09:01:02 +01:00
finalclasses.py
finalprotected.cxx
flatten.cxx
fragiledestructor.cxx
functionaddress.hxx Make base of loplugin::FunctionAddress more flexible 2019-11-11 17:29:06 +01:00
getimplementationname.cxx
getstr.cxx
implicitboolconversion.cxx Missing includes 2019-11-18 17:29:17 +01:00
includeform.cxx
indentation.cxx loplugin:indentation find broken if statements 2019-11-06 06:27:51 +01:00
inlinefields.cxx
inlinefields.py
inlinesimplememberfunctions.cxx
inlinevisible.cxx
intvsfloat.cxx
literaltoboolconversion.cxx
logexceptionnicely.cxx
loopvartoosmall.cxx
mapindex.cxx
memoryvar.cxx
mergeclasses.cxx
mergeclasses.py
mergeclasses.results
methodcycles.cxx
methodcycles.partition.results
methodcycles.py
methodcycles.results
nestedunnamed.cxx
noexceptmove.cxx
nullptr.cxx
oncevar.cxx
oslendian.cxx
overrideparam.cxx
overridevirtual.cxx
pahole-all-classes.py
passparamsbyref.cxx
passstuffbyref.cxx
plugin.cxx Fix Plugin::containsPreprocessingConditionalInclusion 2019-10-30 07:14:17 +01:00
plugin.hxx
pluginhandler.cxx
pluginhandler.hxx
pointerbool.cxx
precompiled_clang.hxx
privatebase.cxx
ptrvector.cxx
rangedforcopy.cxx
readability-redundant-pp.cxx Improve loplugin:redundantpreprocessor performance a bit 2019-11-16 16:55:36 +01:00
redundantcast.cxx loplugin:redundantcast: Don't warn about cast from nullptr_t to function ptr 2019-11-04 17:20:28 +01:00
redundantfcast.cxx loplugin:redundantfcast: Don't warn about cast from braced-init-list 2019-11-20 20:53:01 +01:00
redundantinline.cxx
redundantpointerops.cxx
refcounting.cxx Extend loplugin:external to warn about classes 2019-11-22 12:57:32 +01:00
referencecasting.cxx
rendercontext.cxx
reservedid.cxx
returnconstant.cxx Make base of loplugin::FunctionAddress more flexible 2019-11-11 17:29:06 +01:00
returnconstval.cxx
salcall.cxx
sallogareas.cxx
salunicodeliteral.cxx
selfinit.cxx
sequenceloop.cxx
sequentialassign.cxx
sfxpoolitem.cxx
shouldreturnbool.cxx Make base of loplugin::FunctionAddress more flexible 2019-11-11 17:29:06 +01:00
simplifybool.cxx
simplifyconstruct.cxx
simplifydynamiccast.cxx
singlevalfields.could-be-bool.results loplugin:singlevalfields 2019-11-16 20:19:54 +01:00
singlevalfields.cxx
singlevalfields.py loplugin:singlevalfields 2019-11-16 20:19:54 +01:00
singlevalfields.results loplugin:singlevalfields 2019-11-16 20:19:54 +01:00
staticaccess.cxx
staticanonymous.cxx
staticconstfield.cxx
staticmethods.cxx Extend loplugin:external to warn about classes 2019-11-22 12:57:32 +01:00
staticvar.cxx
stdfunction.cxx
stringadd.cxx Fix StringAdd::isCompileTimeConstant 2019-10-31 09:14:39 +01:00
stringbuffer.cxx
stringconcatauto.cxx
stringconcatliterals.cxx
stringconstant.cxx
stringloop.cxx
stringstatic.cxx
subtlezeroinit.cxx
typedefparam.cxx
unicodetochar.cxx
unnecessarycatchthrow.cxx
unnecessaryoverride.cxx
unnecessaryparen.cxx
unnecessaryvirtual-dead.results loplugin:unnecessaryvirtual 2019-11-06 20:03:32 +01:00
unnecessaryvirtual.cxx
unnecessaryvirtual.py
unnecessaryvirtual.results Rename GlyphCache to FreetypeManager 2019-11-19 03:14:45 +01:00
unoany.cxx
unoquery.cxx
unreffun.cxx
unusedenumconstants.cxx
unusedenumconstants.py loplugin:unusedenumconstants 2019-11-19 20:11:30 +01:00
unusedenumconstants.readonly.results loplugin:unusedenumconstants 2019-11-19 20:11:30 +01:00
unusedenumconstants.untouched.results loplugin:unusedenumconstants 2019-11-19 20:11:30 +01:00
unusedenumconstants.writeonly.results loplugin:unusedenumconstants 2019-11-19 20:11:30 +01:00
unusedfields.cxx
unusedfields.only-used-in-constructor.results loplugin:unusedfields 2019-11-21 18:27:56 +01:00
unusedfields.py loplugin:unusedfields 2019-11-16 12:27:59 +01:00
unusedfields.readonly.results loplugin:unusedfields 2019-11-21 18:27:56 +01:00
unusedfields.untouched.results loplugin:unusedfields 2019-11-21 18:27:56 +01:00
unusedfields.writeonly.results loplugin:unusedfields 2019-11-21 18:27:56 +01:00
unusedfieldsremove.cxx
unusedindex.cxx
unusedmethods.cxx loplugin:unusedmethods 2019-11-20 09:59:17 +01:00
unusedmethods.py loplugin:unusedmethods 2019-11-20 09:59:17 +01:00
unusedmethods.results loplugin:unusedmethods 2019-11-20 20:04:36 +01:00
unusedmethods.unused-returns.results loplugin:unusedmethods 2019-11-17 07:15:22 +01:00
unusedmethodsremove.cxx
unusedvariablecheck.cxx loplugin:unusedvariablecheck tweak to find more stuff 2019-11-06 10:47:15 +01:00
unusedvariablecheck.hxx
unusedvariablemore.cxx
useuniqueptr.cxx
vclwidgets.cxx
virtualdead.cxx
virtualdead.py
virtualdead.results
virtualdead.unusedparams.results
virtualdown.cxx
virtualdown.py
virtualdown.results
weakbase.cxx
weakobject.cxx
writeonlyvars.cxx