demote VectorizeString gcc attribute from const to pure
authorDavid Kalnischkies <david@kalnischkies.de>
Tue, 7 Apr 2015 16:31:12 +0000 (18:31 +0200)
committerDavid Kalnischkies <david@kalnischkies.de>
Tue, 7 Apr 2015 19:59:27 +0000 (21:59 +0200)
g++-5 generates a slightly broken libapt which doesn't split
architecture configurations correctly resulting in e.g. Packages files
requested for the bogus architecture 'amd64,i386' instead of for amd64
and i386.

The reason is an incorrectly applied attribute marking the function as
const, while functions with pointer arguments are not allowed to be
declared as such (note that char& is a char* in disguise). Demoting the
attribute to pure fixes this issue – better would be dropping the & from
char but that is an API change…

Neither earlier g++ versions nor clang use this attribute to generate
broken code, so we don't need a rebuild of dependencies or anything and
g++-5 isn't even included in jessie, but the effect is so strange and
apt popular enough to consider avoiding this problem anyhow.

apt-pkg/contrib/strutl.h

index 185cdc3fc5c3aae13a690d4be79aab053af0860c..f4f80834bccc07749300b5ff8dce54594777a07a 100644 (file)
@@ -79,7 +79,7 @@ bool TokSplitString(char Tok,char *Input,char **List,
                    unsigned long ListMax);
 
 // split a given string by a char
-std::vector<std::string> VectorizeString(std::string const &haystack, char const &split) APT_CONST;
+std::vector<std::string> VectorizeString(std::string const &haystack, char const &split) APT_PURE;
 
 /* \brief Return a vector of strings from string "input" where "sep"
  * is used as the delimiter string.