From 63ff42089863cda53aee240ea0124106e8b4d983 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Fri, 21 Mar 2014 15:54:15 +0100 Subject: [PATCH] enable fvisibility=hidden for our private library While it is a huge undertaking to enable it for our public libraries as basically everything we exported so far could be seen as public interface our private library is new and under our full control, so we can do whatever we like with it. The benefits are not that big in return of course, but it reduces the size a bit, so thats great nontheless. Git-Dch: ignore --- apt-pkg/contrib/macros.h | 4 ++++ apt-private/acqprogress.h | 9 +++++---- apt-private/makefile | 1 + apt-private/private-cachefile.h | 7 ++++--- apt-private/private-cmndline.h | 3 ++- apt-private/private-download.h | 6 ++++-- apt-private/private-install.h | 8 +++++--- apt-private/private-list.h | 4 +++- apt-private/private-main.h | 4 +++- apt-private/private-moo.h | 2 +- apt-private/private-output.h | 21 ++++++++++++--------- apt-private/private-search.h | 4 +++- apt-private/private-show.h | 4 +++- apt-private/private-sources.h | 4 +++- apt-private/private-update.h | 4 +++- apt-private/private-upgrade.h | 6 ++++-- apt-private/private-utils.h | 8 +++++--- 17 files changed, 65 insertions(+), 34 deletions(-) diff --git a/apt-pkg/contrib/macros.h b/apt-pkg/contrib/macros.h index d97053553..2d6448e5e 100644 --- a/apt-pkg/contrib/macros.h +++ b/apt-pkg/contrib/macros.h @@ -94,8 +94,12 @@ #if APT_GCC_VERSION >= 0x0400 #define APT_SENTINEL __attribute__((sentinel)) + #define APT_PUBLIC __attribute__ ((visibility ("default"))) + #define APT_HIDDEN __attribute__ ((visibility ("hidden"))) #else #define APT_SENTINEL + #define APT_PUBLIC + #define APT_HIDDEN #endif // cold functions are unlikely() to be called diff --git a/apt-private/acqprogress.h b/apt-private/acqprogress.h index e12dafe50..71a10d78a 100644 --- a/apt-private/acqprogress.h +++ b/apt-private/acqprogress.h @@ -10,18 +10,19 @@ #define ACQPROGRESS_H #include +#include #include -class AcqTextStatus : public pkgAcquireStatus +class APT_PUBLIC AcqTextStatus : public pkgAcquireStatus { unsigned int &ScreenWidth; char BlankLine[1024]; unsigned long ID; unsigned long Quiet; - + public: - + virtual bool MediaChange(std::string Media,std::string Drive); virtual void IMSHit(pkgAcquire::ItemDesc &Itm); virtual void Fetch(pkgAcquire::ItemDesc &Itm); @@ -29,7 +30,7 @@ class AcqTextStatus : public pkgAcquireStatus virtual void Fail(pkgAcquire::ItemDesc &Itm); virtual void Start(); virtual void Stop(); - + bool Pulse(pkgAcquire *Owner); AcqTextStatus(unsigned int &ScreenWidth,unsigned int const Quiet); diff --git a/apt-private/makefile b/apt-private/makefile index 728890b9b..09736c6d3 100644 --- a/apt-private/makefile +++ b/apt-private/makefile @@ -16,6 +16,7 @@ LIBRARY=apt-private MAJOR=0.0 MINOR=0 SLIBS=$(PTHREADLIB) -lapt-pkg +CXXFLAGS += -fvisibility=hidden -fvisibility-inlines-hidden PRIVATES=list install download output cachefile cacheset update upgrade cmndline moo search show main utils sources SOURCE += $(foreach private, $(PRIVATES), private-$(private).cc) diff --git a/apt-private/private-cachefile.h b/apt-private/private-cachefile.h index 67c5e8cdc..dce7e0a3a 100644 --- a/apt-private/private-cachefile.h +++ b/apt-private/private-cachefile.h @@ -5,16 +5,17 @@ #include #include #include +#include // class CacheFile - Cover class for some dependency cache functions /*{{{*/ // --------------------------------------------------------------------- /* */ -class CacheFile : public pkgCacheFile +class APT_PUBLIC CacheFile : public pkgCacheFile { static pkgCache *SortCache; - static int NameComp(const void *a,const void *b) APT_PURE; - + APT_HIDDEN static int NameComp(const void *a,const void *b) APT_PURE; + public: pkgCache::Package **List; diff --git a/apt-private/private-cmndline.h b/apt-private/private-cmndline.h index 76045ffe7..d0af16782 100644 --- a/apt-private/private-cmndline.h +++ b/apt-private/private-cmndline.h @@ -2,9 +2,10 @@ #define APT_PRIVATE_CMNDLINE_H #include +#include #include -std::vector getCommandArgs(char const * const Program, char const * const Cmd); +APT_PUBLIC std::vector getCommandArgs(char const * const Program, char const * const Cmd); #endif diff --git a/apt-private/private-download.h b/apt-private/private-download.h index 1447845ed..a108aa531 100644 --- a/apt-private/private-download.h +++ b/apt-private/private-download.h @@ -1,9 +1,11 @@ #ifndef APT_PRIVATE_DOWNLOAD_H #define APT_PRIVATE_DOWNLOAD_H +#include + class pkgAcquire; -bool CheckAuth(pkgAcquire& Fetcher, bool const PromptUser); -bool AcquireRun(pkgAcquire &Fetcher, int const PulseInterval, bool * const Failure, bool * const TransientNetworkFailure); +APT_PUBLIC bool CheckAuth(pkgAcquire& Fetcher, bool const PromptUser); +APT_PUBLIC bool AcquireRun(pkgAcquire &Fetcher, int const PulseInterval, bool * const Failure, bool * const TransientNetworkFailure); #endif diff --git a/apt-private/private-install.h b/apt-private/private-install.h index 79769d470..5e18560c5 100644 --- a/apt-private/private-install.h +++ b/apt-private/private-install.h @@ -9,6 +9,9 @@ #include #include #include +#include + +#include #include #include @@ -17,7 +20,6 @@ #include #include -#include "private-output.h" #include @@ -26,13 +28,13 @@ class CommandLine; #define RAMFS_MAGIC 0x858458f6 -bool DoInstall(CommandLine &Cmd); +APT_PUBLIC bool DoInstall(CommandLine &Cmd); bool DoCacheManipulationFromCommandLine(CommandLine &CmdL, CacheFile &Cache, std::map &verset); bool DoCacheManipulationFromCommandLine(CommandLine &CmdL, CacheFile &Cache); -bool InstallPackages(CacheFile &Cache,bool ShwKept,bool Ask = true, +APT_PUBLIC bool InstallPackages(CacheFile &Cache,bool ShwKept,bool Ask = true, bool Safety = true); diff --git a/apt-private/private-list.h b/apt-private/private-list.h index 749744dd1..461f527cb 100644 --- a/apt-private/private-list.h +++ b/apt-private/private-list.h @@ -1,9 +1,11 @@ #ifndef APT_PRIVATE_LIST_H #define APT_PRIVATE_LIST_H +#include + class CommandLine; -bool List(CommandLine &Cmd); +APT_PUBLIC bool List(CommandLine &Cmd); #endif diff --git a/apt-private/private-main.h b/apt-private/private-main.h index 257c51a0b..23d4aca68 100644 --- a/apt-private/private-main.h +++ b/apt-private/private-main.h @@ -1,8 +1,10 @@ #ifndef APT_PRIVATE_MAIN_H #define APT_PRIVATE_MAIN_H +#include + class CommandLine; -void CheckSimulateMode(CommandLine &CmdL); +APT_PUBLIC void CheckSimulateMode(CommandLine &CmdL); #endif diff --git a/apt-private/private-moo.h b/apt-private/private-moo.h index 7bfc5c1fc..b8e1cfed6 100644 --- a/apt-private/private-moo.h +++ b/apt-private/private-moo.h @@ -3,7 +3,7 @@ class CommandLine; -bool DoMoo(CommandLine &CmdL); +APT_PUBLIC bool DoMoo(CommandLine &CmdL); bool DoMoo1(CommandLine &CmdL); bool DoMoo2(CommandLine &CmdL); bool DoMoo3(CommandLine &CmdL); diff --git a/apt-private/private-output.h b/apt-private/private-output.h index 81643f90a..9633d0c37 100644 --- a/apt-private/private-output.h +++ b/apt-private/private-output.h @@ -2,6 +2,7 @@ #define APT_PRIVATE_OUTPUT_H #include +#include #include #include @@ -13,22 +14,24 @@ class pkgDepCache; class pkgRecords; -extern std::ostream c0out; -extern std::ostream c1out; -extern std::ostream c2out; -extern std::ofstream devnull; -extern unsigned int ScreenWidth; +APT_PUBLIC extern std::ostream c0out; +APT_PUBLIC extern std::ostream c1out; +APT_PUBLIC extern std::ostream c2out; +APT_PUBLIC extern std::ofstream devnull; +APT_PUBLIC extern unsigned int ScreenWidth; -bool InitOutput(); -void ListSingleVersion(pkgCacheFile &CacheFile, pkgRecords &records, +APT_PUBLIC bool InitOutput(); + +void ListSingleVersion(pkgCacheFile &CacheFile, pkgRecords &records, pkgCache::VerIterator V, std::ostream &out, bool include_summary=true); // helper to describe global state -bool ShowList(std::ostream &out, std::string Title, std::string List, +APT_PUBLIC void ShowBroken(std::ostream &out,CacheFile &Cache,bool Now); + +APT_PUBLIC bool ShowList(std::ostream &out, std::string Title, std::string List, std::string VersionsList); -void ShowBroken(std::ostream &out,CacheFile &Cache,bool Now); void ShowNew(std::ostream &out,CacheFile &Cache); void ShowDel(std::ostream &out,CacheFile &Cache); void ShowKept(std::ostream &out,CacheFile &Cache); diff --git a/apt-private/private-search.h b/apt-private/private-search.h index 539915f1f..d4786233a 100644 --- a/apt-private/private-search.h +++ b/apt-private/private-search.h @@ -1,9 +1,11 @@ #ifndef APT_PRIVATE_SEARCH_H #define APT_PRIVATE_SEARCH_H +#include + class CommandLine; -bool FullTextSearch(CommandLine &CmdL); +APT_PUBLIC bool FullTextSearch(CommandLine &CmdL); #endif diff --git a/apt-private/private-show.h b/apt-private/private-show.h index a15367e28..359aeeb28 100644 --- a/apt-private/private-show.h +++ b/apt-private/private-show.h @@ -1,12 +1,14 @@ #ifndef APT_PRIVATE_SHOW_H #define APT_PRIVATE_SHOW_H +#include + class CommandLine; namespace APT { namespace Cmd { - bool ShowPackage(CommandLine &CmdL); + APT_PUBLIC bool ShowPackage(CommandLine &CmdL); } } #endif diff --git a/apt-private/private-sources.h b/apt-private/private-sources.h index 4c58af180..0c421902e 100644 --- a/apt-private/private-sources.h +++ b/apt-private/private-sources.h @@ -1,8 +1,10 @@ #ifndef APT_PRIVATE_SOURCES_H #define APT_PRIVATE_SOURCES_H +#include + class CommandLine; -bool EditSources(CommandLine &CmdL); +APT_PUBLIC bool EditSources(CommandLine &CmdL); #endif diff --git a/apt-private/private-update.h b/apt-private/private-update.h index d3d0b7af9..e584f70cf 100644 --- a/apt-private/private-update.h +++ b/apt-private/private-update.h @@ -1,8 +1,10 @@ #ifndef APT_PRIVATE_UPDATE_H #define APT_PRIVATE_UPDATE_H +#include + class CommandLine; -bool DoUpdate(CommandLine &CmdL); +APT_PUBLIC bool DoUpdate(CommandLine &CmdL); #endif diff --git a/apt-private/private-upgrade.h b/apt-private/private-upgrade.h index 64c4c0874..16bb93c9b 100644 --- a/apt-private/private-upgrade.h +++ b/apt-private/private-upgrade.h @@ -1,10 +1,12 @@ #ifndef APTPRIVATE_PRIVATE_UPGRADE_H #define APTPRIVATE_PRIVATE_UPGRADE_H +#include + class CommandLine; -bool DoDistUpgrade(CommandLine &CmdL); -bool DoUpgrade(CommandLine &CmdL); +APT_PUBLIC bool DoDistUpgrade(CommandLine &CmdL); +APT_PUBLIC bool DoUpgrade(CommandLine &CmdL); bool DoUpgradeNoNewPackages(CommandLine &CmdL); bool DoUpgradeWithAllowNewPackages(CommandLine &CmdL); diff --git a/apt-private/private-utils.h b/apt-private/private-utils.h index 4bb535e86..432699787 100644 --- a/apt-private/private-utils.h +++ b/apt-private/private-utils.h @@ -1,9 +1,11 @@ #ifndef APT_PRIVATE_UTILS_H #define APT_PRIVATE_UTILS_H -#include +#include -void DisplayFileInPager(std::string filename); -void EditFileInSensibleEditor(std::string filename); +#include + +APT_PUBLIC void DisplayFileInPager(std::string filename); +APT_PUBLIC void EditFileInSensibleEditor(std::string filename); #endif -- 2.45.2