X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/6c139d6e362f04a1582e8a8f511f8aeab031fecf..bc7c97627e28be226e88ec8b2290b820985b802f:/apt-pkg/contrib/error.h diff --git a/apt-pkg/contrib/error.h b/apt-pkg/contrib/error.h index 06367592b..a5fc1a223 100644 --- a/apt-pkg/contrib/error.h +++ b/apt-pkg/contrib/error.h @@ -1,6 +1,6 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: error.h,v 1.2 1998/07/07 04:17:11 jgg Exp $ +// $Id: error.h,v 1.8 2001/05/07 05:06:52 jgg Exp $ /* ###################################################################### Global Erorr Class - Global error mechanism @@ -37,16 +37,26 @@ ##################################################################### */ /*}}}*/ -// Header section: pkglib #ifndef PKGLIB_ERROR_H #define PKGLIB_ERROR_H #ifdef __GNUG__ -#pragma interface "pkglib/error.h" +#pragma interface "apt-pkg/error.h" #endif +#ifdef __GNUG__ +// Methods have a hidden this parameter that is visible to this attribute +#define APT_MFORMAT1 __attribute__ ((format (printf, 2, 3))) +#define APT_MFORMAT2 __attribute__ ((format (printf, 3, 4))) +#else +#define APT_MFORMAT1 +#define APT_MFORMAT2 +#endif + #include +using std::string; + class GlobalError { struct Item @@ -63,12 +73,13 @@ class GlobalError public: // Call to generate an error from a library call. - bool Errno(const char *Function,const char *Description,...); + bool Errno(const char *Function,const char *Description,...) APT_MFORMAT2; + bool WarningE(const char *Function,const char *Description,...) APT_MFORMAT2; /* A warning should be considered less severe than an error, and may be ignored by the client. */ - bool Error(const char *Description,...); - bool Warning(const char *Description,...); + bool Error(const char *Description,...) APT_MFORMAT1; + bool Warning(const char *Description,...) APT_MFORMAT1; // Simple accessors inline bool PendingError() {return PendingFlag;}; @@ -82,8 +93,11 @@ class GlobalError GlobalError(); }; -/* The 'extra-ansi' syntax is used to help with collisions. This is the - single global instance of this class. */ -extern GlobalError *_error; +// The 'extra-ansi' syntax is used to help with collisions. +GlobalError *_GetErrorObj(); +#define _error _GetErrorObj() + +#undef APT_MFORMAT1 +#undef APT_MFORMAT2 #endif