xref: /dragonfly/contrib/gcc-4.7/libssp/ssp/ssp.h.in (revision f02514df)
1*f02514dfSJohn Marino/* Object size checking support macros.
2*f02514dfSJohn Marino   Copyright (C) 2004, 2005, 2009 Free Software Foundation, Inc.
3*f02514dfSJohn Marino
4*f02514dfSJohn MarinoThis file is part of GCC.
5*f02514dfSJohn Marino
6*f02514dfSJohn MarinoGCC is free software; you can redistribute it and/or modify it under
7*f02514dfSJohn Marinothe terms of the GNU General Public License as published by the Free
8*f02514dfSJohn MarinoSoftware Foundation; either version 3, or (at your option) any later
9*f02514dfSJohn Marinoversion.
10*f02514dfSJohn Marino
11*f02514dfSJohn MarinoIn addition to the permissions in the GNU General Public License, the
12*f02514dfSJohn MarinoFree Software Foundation gives you unlimited permission to link the
13*f02514dfSJohn Marinocompiled version of this file into combinations with other programs,
14*f02514dfSJohn Marinoand to distribute those combinations without any restriction coming
15*f02514dfSJohn Marinofrom the use of this file.  (The General Public License restrictions
16*f02514dfSJohn Marinodo apply in other respects; for example, they cover modification of
17*f02514dfSJohn Marinothe file, and distribution when not linked into a combine
18*f02514dfSJohn Marinoexecutable.)
19*f02514dfSJohn Marino
20*f02514dfSJohn MarinoGCC is distributed in the hope that it will be useful, but WITHOUT ANY
21*f02514dfSJohn MarinoWARRANTY; without even the implied warranty of MERCHANTABILITY or
22*f02514dfSJohn MarinoFITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
23*f02514dfSJohn Marinofor more details.
24*f02514dfSJohn Marino
25*f02514dfSJohn MarinoUnder Section 7 of GPL version 3, you are granted additional
26*f02514dfSJohn Marinopermissions described in the GCC Runtime Library Exception, version
27*f02514dfSJohn Marino3.1, as published by the Free Software Foundation.
28*f02514dfSJohn Marino
29*f02514dfSJohn MarinoYou should have received a copy of the GNU General Public License and
30*f02514dfSJohn Marinoa copy of the GCC Runtime Library Exception along with this program;
31*f02514dfSJohn Marinosee the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
32*f02514dfSJohn Marino<http://www.gnu.org/licenses/>.  */
33*f02514dfSJohn Marino
34*f02514dfSJohn Marino
35*f02514dfSJohn Marino#ifndef _SSP_H
36*f02514dfSJohn Marino#define _SSP_H 1
37*f02514dfSJohn Marino
38*f02514dfSJohn Marino#if _FORTIFY_SOURCE > 0 && __OPTIMIZE__ > 0 \
39*f02514dfSJohn Marino    && defined __GNUC__ \
40*f02514dfSJohn Marino    && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1)) \
41*f02514dfSJohn Marino    && !defined __cplusplus
42*f02514dfSJohn Marino# if _FORTIFY_SOURCE == 1
43*f02514dfSJohn Marino#  define __SSP_FORTIFY_LEVEL 1
44*f02514dfSJohn Marino# elif _FORTIFY_SOURCE > 1
45*f02514dfSJohn Marino#  define __SSP_FORTIFY_LEVEL 2
46*f02514dfSJohn Marino# endif
47*f02514dfSJohn Marino#endif
48*f02514dfSJohn Marino
49*f02514dfSJohn Marino#if __SSP_FORTIFY_LEVEL > 0
50*f02514dfSJohn Marino# include <stddef.h>
51*f02514dfSJohn Marino# define __ssp_bos(ptr) __builtin_object_size (ptr, __SSP_FORTIFY_LEVEL > 1)
52*f02514dfSJohn Marino# define __ssp_bos0(ptr) __builtin_object_size (ptr, 0)
53*f02514dfSJohn Marino
54*f02514dfSJohn Marino# define __SSP_REDIRECT(name, proto, alias) \
55*f02514dfSJohn Marino  name proto __asm__ (__SSP_ASMNAME (#alias))
56*f02514dfSJohn Marino# define __SSP_ASMNAME(cname)  __SSP_ASMNAME2 (__USER_LABEL_PREFIX__, cname)
57*f02514dfSJohn Marino# define __SSP_ASMNAME2(prefix, cname) __SSP_ASMNAME3 (prefix) cname
58*f02514dfSJohn Marino# define __SSP_ASMNAME3(prefix) #prefix
59*f02514dfSJohn Marino
60*f02514dfSJohn Marino# @ssp_have_usable_vsnprintf@ __SSP_HAVE_VSNPRINTF
61*f02514dfSJohn Marino
62*f02514dfSJohn Marinoextern void __chk_fail (void) __attribute__((__noreturn__));
63*f02514dfSJohn Marino#endif
64*f02514dfSJohn Marino
65*f02514dfSJohn Marino#endif /* _SSP_H */
66