Compiling GnuPG 2.0.1 on MacOS X

Christian Biere christianbiere at gmx.de
Wed Feb 14 15:06:35 CET 2007


Peter Pentchev wrote:
> #include <stdio.h>
> #include <unistd.h>
> 
> #ifndef __unused
> #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
> #define __unused	__attribute__((unused))
> #else	/* __GNUC__ */
> #if defined(__INTEL_COMPILER)
> #define __unused	__attribute__((__unused__))
> #else	/* __INTEL_COMPILER */
> #define __unused
> #endif	/* __INTEL_COMPILER */
> #endif	/* __GNUC__ */
> #endif	/* __unused */
> 
> #define APP	"/Applications/pinentry-mac.app/Contents/MacOS/pinentry-mac"
> 
> int main(int argc __unused, char * const argv[])
> {
> 	execv(APP, argv);
> 	perror("execv");
> 	return (1);
> }
> 
> Of course, you may skip the whole __unused dance if you know that you
> are only ever going to compile it on a single OS/arch/compiler - or if
> you don't care about compiler warnings :)

How about sticking to portable standard C?

(void) argc;

works everywhere. You cannot defined __unused yourself. This namespace is
reserved for the implementation. And it looks quite ugly anyway. It's not
like you need C for this anyway:

#! /bin/sh
exec whatever "$@"
exit 1

-- 
Christian



More information about the Gnupg-devel mailing list