2 * have_unused - Determine if we want or can support the unused attribute
4 * Copyright (C) 2004 Landon Curt Noll
6 * Calc is open software; you can redistribute it and/or modify it under
7 * the terms of the version 2.1 of the GNU Lesser General Public License
8 * as published by the Free Software Foundation.
10 * Calc is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
13 * Public License for more details.
15 * A copy of version 2.1 of the GNU Lesser General Public License is
16 * distributed with calc under the filename COPYING-LGPL. You should have
17 * received a copy with calc; if not, write to Free Software Foundation, Inc.
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 * @(#) $Revision: 30.1 $
21 * @(#) $Id: have_unused.c,v 30.1 2007/03/16 11:09:46 chongo Exp $
22 * @(#) $Source: /usr/local/src/bin/calc/RCS/have_unused.c,v $
24 * Under source code control: 2004/02/22 22:36:10
25 * File existed as early as: 2004
27 * chongo <was here> /\oo/\ http://www.isthe.com/chongo/
28 * Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
35 * Not all compilers support the unused attribute, so this may not compile
38 * This prog outputs several defines:
41 * defined ==> ok to use unused
42 * undefined ==> do not use unused
45 * unused ==> use unused
46 * (nothing) ==> unused not used
52 #if !defined(HAVE_NO_UNUSED)
54 /* make sure that we can use the __attribute__((unused)) in #define's */
56 #define UNUSED __attribute__((unused))
59 * unused_str - a function with an unused argument
62 unused_str(char UNUSED
*str
)
64 return "__attribute__((unused))";
67 #endif /* !HAVE_NO_UNUSED */
73 #if defined(HAVE_NO_UNUSED)
75 printf("#undef HAVE_UNUSED /* no */\n");
76 printf("#undef UNUSED\n");
77 printf("#define UNUSED /* no */\n");
79 #else /* HAVE_NO_UNUSED */
81 printf("#define HAVE_UNUSED /* yes */\n");
82 printf("#undef UNUSED\n");
83 printf("#define UNUSED %s /* yes */\n", unused_str(NULL
));
85 #endif /* HAVE_NO_UNUSED */