Преглед на файлове

libdpkg: Rename and namespace compiler attributes

Prefix them all with DPKG_ATTR_, and use shorter but still meaningful
names.
Guillem Jover преди 17 години
родител
ревизия
da17101a4a
променени са 14 файла, в които са добавени 43 реда и са изтрити 43 реда
  1. 1 1
      dpkg-deb/dpkg-deb.h
  2. 1 1
      dpkg-deb/extract.c
  3. 3 3
      dpkg-split/dpkg-split.h
  4. 2 2
      dselect/methparse.cc
  5. 1 1
      lib/dpkg/dpkg-db.h
  6. 8 8
      lib/dpkg/dpkg-def.h
  7. 13 13
      lib/dpkg/dpkg.h
  8. 1 1
      lib/dpkg/ehandle.c
  9. 1 1
      lib/dpkg/mlib.c
  10. 4 4
      lib/dpkg/myopt.h
  11. 2 2
      lib/dpkg/parsedump.h
  12. 1 1
      src/main.c
  13. 3 3
      src/main.h
  14. 2 2
      utils/start-stop-daemon.c

+ 1 - 1
dpkg-deb/dpkg-deb.h

@@ -23,7 +23,7 @@
 #define DPKG_DEB_H
 
 typedef void dofunction(const char *const *argv);
-dofunction do_build NONRETURNING; 
+dofunction do_build DPKG_ATTR_NORET;
 dofunction do_contents, do_control, do_showinfo;
 dofunction do_info, do_field, do_extract, do_vextract, do_fsystarfile;
 

+ 1 - 1
dpkg-deb/extract.c

@@ -57,7 +57,7 @@ static void movecontrolfiles(const char *thing) {
   waitsubproc(c1,"sh -c mv foo/* &c",0);
 }
 
-static void readfail(FILE *a, const char *filename, const char *what) NONRETURNING;
+static void readfail(FILE *a, const char *filename, const char *what) DPKG_ATTR_NORET;
 static void readfail(FILE *a, const char *filename, const char *what) {
   if (ferror(a)) {
     ohshite(_("error reading %s from file %.255s"), what, filename);

+ 3 - 3
dpkg-split/dpkg-split.h

@@ -23,7 +23,7 @@
 #define DPKG_SPLIT_H
 
 typedef void dofunction(const char *const *argv);
-dofunction do_split NONRETURNING;
+dofunction do_split DPKG_ATTR_NORET;
 dofunction do_join, do_info, do_auto, do_queue, do_discard;
 
 struct partinfo {
@@ -57,8 +57,8 @@ extern const char *depotdir, *outputfile;
 extern struct partqueue *queue;
 extern int npquiet, msdos;
 
-void rerr(const char *fn) NONRETURNING;
-void rerreof(FILE *f, const char *fn) NONRETURNING;
+void rerr(const char *fn) DPKG_ATTR_NORET;
+void rerreof(FILE *f, const char *fn) DPKG_ATTR_NORET;
 void print_info(const struct partinfo *pi);
 struct partinfo *read_info(FILE *partfile, const char *fn, struct partinfo *ir);
 

+ 2 - 2
dselect/methparse.cc

@@ -48,13 +48,13 @@ int noptions=0;
 struct dselect_option *options=0, *coption=0;
 struct method *methods=0;
 
-static void badmethod(const char *pathname, const char *why) NONRETURNING;
+static void badmethod(const char *pathname, const char *why) DPKG_ATTR_NORET;
 static void badmethod(const char *pathname, const char *why)
 {
   ohshit(_("syntax error in method options file `%.250s' -- %s"), pathname, why);
 }
 
-static void eofmethod(const char *pathname, FILE *f, const char *why) NONRETURNING;
+static void eofmethod(const char *pathname, FILE *f, const char *why) DPKG_ATTR_NORET;
 static void eofmethod(const char *pathname, FILE *f, const char *why) {
   if (ferror(f)) ohshite(_("error reading options file `%.250s'"),pathname);
   badmethod(pathname,why);

+ 1 - 1
lib/dpkg/dpkg-db.h

@@ -380,7 +380,7 @@ struct varbuf;
 extern void varbufaddc(struct varbuf *v, int c);
 extern void varbufdupc(struct varbuf *v, int c, size_t s);
 extern void varbufsubstc(struct varbuf *v, int c_src, int c_dst);
-int varbufprintf(struct varbuf *v, const char *fmt, ...) PRINTFFORMAT(2);
+int varbufprintf(struct varbuf *v, const char *fmt, ...) DPKG_ATTR_PRINTF(2);
 int varbufvprintf(struct varbuf *v, const char *fmt, va_list va);
 void varbufinit(struct varbuf *v, size_t size);
 void varbufreset(struct varbuf *v);

+ 8 - 8
lib/dpkg/dpkg-def.h

@@ -23,15 +23,15 @@
 #define DPKG_DEF_H
 
 #if HAVE_C_ATTRIBUTE
-# define CONSTANT __attribute__((constant))
-# define PRINTFFORMAT(n) __attribute__((format(printf, n, n + 1)))
-# define NONRETURNING __attribute__((noreturn))
-# define UNUSED __attribute__((unused))
+#define DPKG_ATTR_UNUSED	__attribute__((unused))
+#define DPKG_ATTR_CONST		__attribute__((constant))
+#define DPKG_ATTR_NORET		__attribute__((noreturn))
+#define DPKG_ATTR_PRINTF(n)	__attribute__((format(printf, n, n + 1)))
 #else
-# define CONSTANT
-# define PRINTFFORMAT(n)
-# define NONRETURNING
-# define UNUSED
+#define DPKG_ATTR_UNUSED
+#define DPKG_ATTR_CONST
+#define DPKG_ATTR_NORET
+#define DPKG_ATTR_PRINTF(n)
 #endif
 
 #ifdef __cplusplus

+ 13 - 13
lib/dpkg/dpkg.h

@@ -155,7 +155,7 @@ void push_checkpoint(int mask, int value);
 void pop_cleanup(int flagset);
 enum { ehflag_normaltidy=01, ehflag_bombout=02, ehflag_recursiveerror=04 };
 
-void do_internerr(const char *file, int line, const char *fmt, ...) NONRETURNING;
+void do_internerr(const char *file, int line, const char *fmt, ...) DPKG_ATTR_NORET;
 #if HAVE_C99
 #define internerr(...) do_internerr(__FILE__, __LINE__, __VA_ARGS__)
 #else
@@ -163,16 +163,16 @@ void do_internerr(const char *file, int line, const char *fmt, ...) NONRETURNING
 #endif
 
 struct varbuf;
-void ohshit(const char *fmt, ...) NONRETURNING PRINTFFORMAT(1);
-void ohshitv(const char *fmt, va_list al) NONRETURNING;
-void ohshite(const char *fmt, ...) NONRETURNING PRINTFFORMAT(1);
-void werr(const char *what) NONRETURNING;
-void warning(const char *fmt, ...) PRINTFFORMAT(1);
+void ohshit(const char *fmt, ...) DPKG_ATTR_NORET DPKG_ATTR_PRINTF(1);
+void ohshitv(const char *fmt, va_list al) DPKG_ATTR_NORET;
+void ohshite(const char *fmt, ...) DPKG_ATTR_NORET DPKG_ATTR_PRINTF(1);
+void werr(const char *what) DPKG_ATTR_NORET;
+void warning(const char *fmt, ...) DPKG_ATTR_PRINTF(1);
 
 /*** log.c ***/
 
 extern const char *log_file;
-void log_message(const char *fmt, ...) PRINTFFORMAT(1);
+void log_message(const char *fmt, ...) DPKG_ATTR_PRINTF(1);
 
 /* FIXME: pipef and status_pipes should not be publicly exposed. */
 struct pipef {
@@ -321,16 +321,16 @@ struct buffer_data {
 
 off_t buffer_copy_setup_PtrInt(void *p, int typeIn, void *procIn,
 					int i, int typeOut, void *procOut,
-					off_t limit, const char *desc, ...) PRINTFFORMAT(8);
+                               off_t limit, const char *desc, ...) DPKG_ATTR_PRINTF(8);
 off_t buffer_copy_setup_PtrPtr(void *p1, int typeIn, void *procIn,
 					void *p2, int typeOut, void *procOut,
-					off_t limit, const char *desc, ...) PRINTFFORMAT(8);
+                               off_t limit, const char *desc, ...) DPKG_ATTR_PRINTF(8);
 off_t buffer_copy_setup_IntPtr(int i, int typeIn, void *procIn,
 					void *p, int typeOut, void *procOut,
-					off_t limit, const char *desc, ...) PRINTFFORMAT(8);
+                               off_t limit, const char *desc, ...) DPKG_ATTR_PRINTF(8);
 off_t buffer_copy_setup_IntInt(int i1, int typeIn, void *procIn,
 					int i2, int typeOut, void *procOut,
-					off_t limit, const char *desc, ...) PRINTFFORMAT(8);
+                               off_t limit, const char *desc, ...) DPKG_ATTR_PRINTF(8);
 off_t buffer_copy_setup(buffer_arg argIn, int typeIn, void *procIn,
 		       buffer_arg argOut, int typeOut, void *procOut,
 		       off_t limit, const char *desc);
@@ -357,10 +357,10 @@ enum compress_type {
 };
 
 void decompress_cat(enum compress_type type, int fd_in, int fd_out,
-                    char *desc, ...) NONRETURNING PRINTFFORMAT(4);
+                    char *desc, ...) DPKG_ATTR_NORET DPKG_ATTR_PRINTF(4);
 void compress_cat(enum compress_type type, int fd_in, int fd_out,
                   const char *compression, char *desc, ...)
-                  NONRETURNING PRINTFFORMAT(5);
+                  DPKG_ATTR_NORET DPKG_ATTR_PRINTF(5);
 
 DPKG_END_DECLS
 

+ 1 - 1
lib/dpkg/ehandle.c

@@ -80,7 +80,7 @@ void set_error_display(error_printer *printerror,
   econtext->contextstring= contextstring;
 }
 
-static void run_error_handler(void) NONRETURNING;
+static void run_error_handler(void) DPKG_ATTR_NORET;
 
 static void
 run_error_handler(void)

+ 1 - 1
lib/dpkg/mlib.c

@@ -83,7 +83,7 @@ static void print_error_forked(const char *emsg, const char *contextstring) {
   fprintf(stderr, _("%s (subprocess): %s\n"), thisname, emsg);
 }
 
-static void cu_m_fork(int argc, void **argv) NONRETURNING;
+static void cu_m_fork(int argc, void **argv) DPKG_ATTR_NORET;
 static void cu_m_fork(int argc, void **argv) {
   exit(2);
   /* Don't do the other cleanups, because they'll be done by/in the parent

+ 4 - 4
lib/dpkg/myopt.h

@@ -42,7 +42,7 @@ struct cmdinfo {
 
 extern const char printforhelp[];
 
-void badusage(const char *fmt, ...) NONRETURNING PRINTFFORMAT(1);
+void badusage(const char *fmt, ...) DPKG_ATTR_NORET DPKG_ATTR_PRINTF(1);
 
 #define MAX_CONFIG_LINE 1024
 
@@ -51,9 +51,9 @@ void myopt(const char *const **argvp, const struct cmdinfo *cmdinfos);
 void loadcfgfile(const char *prog, const struct cmdinfo *cmdinfos);
 
 /* Utility functions. */
-void showcopyright(const struct cmdinfo *cip, const char *value) NONRETURNING;
-void helponly(const struct cmdinfo *cip, const char *value) NONRETURNING;
-void versiononly(const struct cmdinfo *cip, const char *value) NONRETURNING;
+void showcopyright(const struct cmdinfo *cip, const char *value) DPKG_ATTR_NORET;
+void helponly(const struct cmdinfo *cip, const char *value) DPKG_ATTR_NORET;
+void versiononly(const struct cmdinfo *cip, const char *value) DPKG_ATTR_NORET;
 
 /* To be defined by callers. */
 void usage(void);

+ 2 - 2
lib/dpkg/parsedump.h

@@ -67,9 +67,9 @@ struct fieldinfo {
 };
 
 void parse_error(struct parsedb_state *ps, const struct pkginfo *pigp,
-                 const char *fmt, ...) PRINTFFORMAT(3);
+                 const char *fmt, ...) DPKG_ATTR_PRINTF(3);
 void parse_warn(struct parsedb_state *ps, const struct pkginfo *pigp,
-                const char *fmt, ...) PRINTFFORMAT(3);
+                const char *fmt, ...) DPKG_ATTR_PRINTF(3);
 void parse_must_have_field(struct parsedb_state *ps,
                            const struct pkginfo *pigp,
                            const char *value, const char *what);

+ 1 - 1
src/main.c

@@ -382,7 +382,7 @@ static void setforce(const struct cmdinfo *cip, const char *value) {
 
 static const char okpassshortopts[]= "D";
 
-void execbackend(const char *const *argv) NONRETURNING;
+void execbackend(const char *const *argv) DPKG_ATTR_NORET;
 void commandfd(const char *const *argv);
 static const struct cmdinfo cmdinfos[]= {
   /* This table has both the action entries in it and the normal options.

+ 3 - 3
src/main.h

@@ -129,7 +129,7 @@ void assertmulticonrep(const char *const *argv);
 void predeppackage(const char *const *argv);
 void printarch(const char *const *argv);
 void printinstarch(const char *const *argv);
-void cmpversions(const char *const *argv) NONRETURNING;
+void cmpversions(const char *const *argv) DPKG_ATTR_NORET;
 
 /* Intended for use as a comparison function for qsort when
  * sorting an array of pointers to struct pkginfo:
@@ -178,7 +178,7 @@ void cu_prermremove(int argc, void **argv);
 /* from errors.c */
 
 void print_error_perpackage(const char *emsg, const char *arg);
-void forcibleerr(int forceflag, const char *format, ...) PRINTFFORMAT(2);
+void forcibleerr(int forceflag, const char *format, ...) DPKG_ATTR_PRINTF(2);
 int reportbroken_retexitstatus(void);
 int skip_due_to_hold(struct pkginfo *pkg);
 
@@ -240,7 +240,7 @@ enum debugflags {
   dbg_triggersstupid =  040000,
 };
   
-void debug(int which, const char *fmt, ...) PRINTFFORMAT(2);
+void debug(int which, const char *fmt, ...) DPKG_ATTR_PRINTF(2);
 void log_action(const char *action, struct pkginfo *pkg);
 
 /* from trigproc.c */

+ 2 - 2
utils/start-stop-daemon.c

@@ -220,9 +220,9 @@ static int pid_is_exec(pid_t pid, const struct stat *esb);
 
 
 static void fatal(const char *format, ...)
-	NONRETURNING PRINTFFORMAT(1);
+	DPKG_ATTR_NORET DPKG_ATTR_PRINTF(1);
 static void badusage(const char *msg)
-	NONRETURNING;
+	DPKG_ATTR_NORET;
 
 static void
 warning(const char *format, ...)