1 /*
2  * have_ban_pragma.c - Determine if we have #pragma GCC poison func_name
3  *
4  * Copyright (C) 2021  Landon Curt Noll
5  *
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.
9  *
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.
14  *
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.
19  *
20  * Under source code control:	2021/03/08 01:02:34
21  * File existed as early as:	2021
22  *
23  * chongo <was here> /\oo/\	http://www.isthe.com/chongo/
24  * Share and enjoy!  :-)	http://www.isthe.com/chongo/tech/comp/calc/
25  */
26 
27 /*
28  * usage:
29  *	have_ban_pragma
30  *
31  * Not all systems have #pragma GCC poison func_name, so this may not
32  * compile on your system.
33  *
34  * This prog outputs several defines:
35  *
36  *	HAVE_PRAGMA_GCC_POSION
37  *		defined ==> use #pragma GCC poison func_name
38  *		undefined ==> do not use #pragma GCC poison func_name
39  *
40  * NOTE: Modern clang compilers allow for 'pragma GCC poison func_name'.
41  *	 This is NOT simply a GCC feature.
42  */
43 
44 #include <stdio.h>
45 
46 
47 /* undef UNBAN to be undefined to force use of banned.h */
48 #undef UNBAN
49 
50 /* prevent banned.h from including have_ban_pragma.h */
51 #define PRE_HAVE_BAN_PRAGMA_H
52 
53 #include "banned.h"	/* include after system header <> includes */
54 
55 
56 int
main(void)57 main(void)
58 {
59 #if defined(HAVE_NO_PRAGMA_GCC_POSION)
60 
61 	printf("#undef HAVE_PRAGMA_GCC_POSION /* no */\n");
62 
63 #else /* HAVE_NO_PRAGMA_GCC_POSION */
64 
65 	printf("#define HAVE_PRAGMA_GCC_POSION /* yes */\n");
66 
67 #endif /* HAVE_NO_PRAGMA_GCC_POSION */
68 
69 	/* exit(0); */
70 	return 0;
71 }
72