Procházet zdrojové kódy

Define an UNUSED macro for __attribute((unused))__.

Adam Heath před 24 roky
rodič
revize
9bb29ef377
4 změnil soubory, kde provedl 23 přidání a 1 odebrání
  1. 5 0
      ChangeLog
  2. 12 0
      config.h.bot
  3. 5 0
      configure.in
  4. 1 1
      optlib/getopt.c

+ 5 - 0
ChangeLog

@@ -1,3 +1,8 @@
+Sun May 19 02:31:11 CDT 2002 Adam Heath <doogie@debian.org>
+
+  * config.h.bot, configure.in, optlib/getopt.c: Define an UNUSED macro,
+    for __attribute__((unused)).
+
 Sun May 19 02:31:11 CDT 2002 Adam Heath <doogie@debian.org>
 Sun May 19 02:31:11 CDT 2002 Adam Heath <doogie@debian.org>
 
 
   * optlib/error.h, optlib/getopt.c, utils/start-stop-daemon.c: Use
   * optlib/error.h, optlib/getopt.c, utils/start-stop-daemon.c: Use

+ 12 - 0
config.h.bot

@@ -78,6 +78,18 @@
 #define CONSTANT FUNCATTR((ATTRCONST))
 #define CONSTANT FUNCATTR((ATTRCONST))
 #endif
 #endif
 
 
+/* GNU C unused functions, or null. */
+#ifndef ATTRUNUSED
+#ifdef HAVE_GNUC25_UNUSED
+#define ATTRUNUSED
+#else
+#define ATTRUNUSED
+#endif
+#endif
+#ifndef UNUSED
+#define UNUSED FUNCATTR((ATTRUNUSED))
+#endif
+
 /* Declare strerror if we don't have it already. */
 /* Declare strerror if we don't have it already. */
 #ifndef HAVE_STRERROR
 #ifndef HAVE_STRERROR
 const char *strerror(int);
 const char *strerror(int);

+ 5 - 0
configure.in

@@ -203,6 +203,11 @@ DPKG_CACHED_TRY_COMPILE(__attribute__((,,)),dpkg_cv_c_attribute_supported,,
    AC_MSG_RESULT(yes)
    AC_MSG_RESULT(yes)
    AC_DEFINE(HAVE_GNUC25_CONST),
    AC_DEFINE(HAVE_GNUC25_CONST),
    AC_MSG_RESULT(no))
    AC_MSG_RESULT(no))
+  DPKG_CACHED_TRY_COMPILE(__attribute__((unused)),dpkg_cv_c_attribute_unused,,
+   [extern int testfunction(int x) __attribute__((unused))],
+   AC_MSG_RESULT(yes)
+   AC_DEFINE(HAVE_GNUC25_UNUSED),
+   AC_MSG_RESULT(no))
   DPKG_CACHED_TRY_COMPILE(__attribute__((format...)),dpkg_cv_attribute_format,,
   DPKG_CACHED_TRY_COMPILE(__attribute__((format...)),dpkg_cv_attribute_format,,
    [extern int testfunction(char *y, ...) __attribute__((format(printf,1,2)))],
    [extern int testfunction(char *y, ...) __attribute__((format(printf,1,2)))],
    AC_MSG_RESULT(yes)
    AC_MSG_RESULT(yes)

+ 1 - 1
optlib/getopt.c

@@ -270,7 +270,7 @@ extern pid_t __libc_pid;
    is valid for the getopt call we must make sure that the ARGV passed
    is valid for the getopt call we must make sure that the ARGV passed
    to getopt is that one passed to the process.  */
    to getopt is that one passed to the process.  */
 static void
 static void
-FUNCATTR(unused)
+UNUSED
 store_args_and_env (int argc, char *const *argv)
 store_args_and_env (int argc, char *const *argv)
 {
 {
   /* XXX This is no good solution.  We should rather copy the args so
   /* XXX This is no good solution.  We should rather copy the args so