mirror of
https://codeberg.org/guix/guix.git
synced 2026-01-25 03:55:08 -06:00
* nix/boost: This directory and all files inside it are removed. * nix/libstore/build.cc (Goal::trace): Use ‘std::string’ instead of ‘const format &’. (DerivationGoal::startBuilder, ...): Use ‘std::format’ or ‘std::vformat’ instead of ‘boost::format’. * nix/libstore/builtins.cc (builtinDownload): Same. * nix/libstore/derivations.cc (DerivationOutput::parseHashInfo, ...): Same. * nix/libstore/gc.cc (LocalStore::openGCLock, ...): Same. * nix/libstore/globals.cc (Settings::_get): Same. * nix/libstore/local-store.cc: (checkStoreNotSymlink, ...): Same. * nix/libstore/misc.cc (dfsVisit, showBytes): Same * nix/libstore/optimise-store.cc (makeWritable, ...): Same. * nix/libstore/pathlocks.cc (openLockFile, ...): Same. * nix/libstore/references.cc (search, scanForReferences): Same. * nix/libstore/sqlite.hh (throwSQLiteError): Use ‘std::string’ instead of ‘const format &’. * nix/libstore/sqlite.cc (throwSQLiteError): Use ‘std::string’ instead of ‘const format &’. * nix/libstore/store-api.cc (assertStorePath, ...): Use ‘std::format’ instead of ‘boost::format’. * nix/libutil/affinity.cc (setAffinityTo): Same. * nix/libutil/archive.cc (dumpContents, ...): Same. * nix/libutil/hash.cc (parseHash, parseHash32, parseHash16or32, hashFile): Same. * nix/libutil/hash.hh (parseHash, parseHash32, parseHash16or32, isHash): Same. * nix/libutil/serialise.cc : Add ‘<cassert>’ header file. * nix/libutil/spawn.cc (addPhaseAfter, ...): Use ‘std::format’ instead of ‘boost::format’. * nix/libutil/types.hh (FormatOrString): Removed. (BaseError, BaseError::addPrefix, SysError, MakeError): Use ‘std::string or std::string_view’ instead of ‘FormatOrString’. * nix/libutil/util.hh (Nest::open, printMsg_, warnOnce, expect): Same. * nix/libutil/util.cc (BaseError::BaseError, ...): Same. (writeToStderr, _interrupted): Use std::uncaught_exceptions() instead of std::uncaught_exception() * nix/nix-daemon/nix-daemon.cc (performOp, ...): Same. * nix/nix-daemon/guix-daemon.cc (string_to_bool, ...): Same. * nix/local.mk: Remove ‘libformat.a’ from ‘noinst_LIBRARIES’, remove ‘libformat_a_SOURCES’ and ‘libformat_headers’, remove ‘libformat_a_CPPFLAGS’ from ‘libutil_a_CPPFLAGS’ and ‘guix_daemon_LDADD’, update ‘AM_CXXFLAGS’ to ‘-std=c++20’. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
90 lines
2 KiB
C++
90 lines
2 KiB
C++
#pragma once
|
|
|
|
#include "config.h"
|
|
|
|
#include <string>
|
|
#include <list>
|
|
#include <set>
|
|
#include <vector>
|
|
#include <string_view>
|
|
|
|
|
|
/* Before 4.7, gcc's std::exception uses empty throw() specifiers for
|
|
* its (virtual) destructor and what() in c++11 mode, in violation of spec
|
|
*/
|
|
#ifdef __GNUC__
|
|
#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 7)
|
|
#define EXCEPTION_NEEDS_THROW_SPEC
|
|
#endif
|
|
#endif
|
|
|
|
|
|
namespace nix {
|
|
|
|
|
|
/* Inherit some names from other namespaces for convenience. */
|
|
using std::string;
|
|
using std::list;
|
|
using std::set;
|
|
using std::vector;
|
|
|
|
|
|
/* BaseError should generally not be caught, as it has Interrupted as
|
|
a subclass. Catch Error instead. */
|
|
class BaseError : public std::exception
|
|
{
|
|
protected:
|
|
string prefix_; // used for location traces etc.
|
|
string err;
|
|
public:
|
|
unsigned int status; // exit status
|
|
BaseError(std::string_view fs, unsigned int status = 1);
|
|
#ifdef EXCEPTION_NEEDS_THROW_SPEC
|
|
~BaseError() throw () { };
|
|
const char * what() const throw () { return err.c_str(); }
|
|
#else
|
|
const char * what() const noexcept { return err.c_str(); }
|
|
#endif
|
|
const string & msg() const { return err; }
|
|
const string & prefix() const { return prefix_; }
|
|
BaseError & addPrefix(std::string fs);
|
|
};
|
|
|
|
#define MakeError(newClass, superClass) \
|
|
class newClass : public superClass \
|
|
{ \
|
|
public: \
|
|
newClass(std::string_view fs, unsigned int status = 1) : superClass(fs, status) { }; \
|
|
};
|
|
|
|
MakeError(Error, BaseError)
|
|
|
|
class SysError : public Error
|
|
{
|
|
public:
|
|
int errNo;
|
|
SysError(std::string_view fs);
|
|
};
|
|
|
|
|
|
using Strings = std::list<std::string>;
|
|
using StringSet = std::set<std::string>;
|
|
|
|
|
|
/* Paths are just strings. */
|
|
using Path = std::string;
|
|
using Paths = std::list<Path>;
|
|
using PathSet = std::set<Path>;
|
|
|
|
|
|
enum Verbosity {
|
|
lvlError = 0,
|
|
lvlInfo,
|
|
lvlTalkative,
|
|
lvlChatty,
|
|
lvlDebug,
|
|
lvlVomit
|
|
};
|
|
|
|
|
|
}
|