[openssh-commits] [openssh] 02/02: Check for attributes on prototype args.

git+noreply at mindrot.org git+noreply at mindrot.org
Tue Feb 27 08:52:23 AEDT 2018


This is an automated email from the git hooks/post-receive script.

dtucker pushed a commit to branch master
in repository openssh.

commit 1323f120d06a26074c4d154fcbe7f49bcad3d741
Author: Darren Tucker <dtucker at dtucker.net>
Date:   Tue Feb 27 08:41:25 2018 +1100

    Check for attributes on prototype args.
    
    Some compilers (gcc 2.9.53, 3.0 and probably others, see gcc bug #3481)
    do not accept __attribute__ on function pointer prototype args.  Check for
    this and hide them if they're not accepted.
---
 configure.ac | 12 ++++++++++++
 sshkey.h     |  4 ++++
 2 files changed, 16 insertions(+)

diff --git a/configure.ac b/configure.ac
index 35e2e8d1..0ba2ff44 100644
--- a/configure.ac
+++ b/configure.ac
@@ -265,6 +265,18 @@ __attribute__((__unused__)) static void foo(void){return;}]],
 	 [compiler does not accept __attribute__ on return types]) ]
 )
 
+AC_MSG_CHECKING([if compiler allows __attribute__ prototype args])
+AC_COMPILE_IFELSE(
+    [AC_LANG_PROGRAM([[
+#include <stdlib.h>
+typedef void foo(const char *, ...) __attribute__((format(printf, 1, 2)));]],
+    [[ exit(0); ]])],
+    [ AC_MSG_RESULT([yes]) ],
+    [ AC_MSG_RESULT([no])
+      AC_DEFINE(NO_ATTRIBUTE_ON_PROTOTYPE_ARGS, 1,
+	 [compiler does not accept __attribute__ on protoype args]) ]
+)
+
 if test "x$no_attrib_nonnull" != "x1" ; then
 	AC_DEFINE([HAVE_ATTRIBUTE__NONNULL__], [1], [Have attribute nonnull])
 fi
diff --git a/sshkey.h b/sshkey.h
index c795815f..155cd45a 100644
--- a/sshkey.h
+++ b/sshkey.h
@@ -220,7 +220,11 @@ int	sshkey_parse_private_fileblob_type(struct sshbuf *blob, int type,
 int ssh_rsa_generate_additional_parameters(struct sshkey *);
 
 /* stateful keys (e.g. XMSS) */
+#ifdef NO_ATTRIBUTE_ON_PROTOTYPE_ARGS
+typedef void sshkey_printfn(const char *, ...);
+#else
 typedef void sshkey_printfn(const char *, ...) __attribute__((format(printf, 1, 2)));
+#endif
 int	 sshkey_set_filename(struct sshkey *, const char *);
 int	 sshkey_enable_maxsign(struct sshkey *, u_int32_t);
 u_int32_t sshkey_signatures_left(const struct sshkey *);

-- 
To stop receiving notification emails like this one, please contact
djm at mindrot.org.


More information about the openssh-commits mailing list