ReactOS 0.4.15-dev-8102-g108db8f
ccomdefs.h
Go to the documentation of this file.
1/* @(#)ccomdefs.h 1.12 11/07/21 Copyright 2000-2011 J. Schilling */
2/*
3 * Various compiler dependant macros.
4 *
5 * Copyright (c) 2000-2011 J. Schilling
6 */
7/*
8 * The contents of this file are subject to the terms of the
9 * Common Development and Distribution License, Version 1.0 only
10 * (the "License"). You may not use this file except in compliance
11 * with the License.
12 *
13 * See the file CDDL.Schily.txt in this distribution for details.
14 *
15 * When distributing Covered Code, include this CDDL HEADER in each
16 * file and include the License file CDDL.Schily.txt from this distribution.
17 */
18
19#ifndef _SCHILY_CCOMDEFS_H
20#define _SCHILY_CCOMDEFS_H
21
22#ifndef _SCHILY_MCONFIG_H
23#include <schily/mconfig.h>
24#endif
25
26#ifdef __cplusplus
27extern "C" {
28#endif
29
30/*
31 * Compiler-dependent macros to declare that functions take printf-like
32 * or scanf-like arguments. They are defined to nothing for versions of gcc
33 * that are not known to support the features properly (old versions of gcc-2
34 * didn't permit keeping the keywords out of the application namespace).
35 */
36#if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7) || \
37 defined(NO_PRINTFLIKE)
38
39#define __printflike__(fmtarg, firstvararg)
40#define __printf0like__(fmtarg, firstvararg)
41#define __scanflike__(fmtarg, firstvararg)
42
43#else /* We found GCC that supports __attribute__ */
44
45#define __printflike__(fmtarg, firstvararg) \
46 __attribute__((__format__(__printf__, fmtarg, firstvararg)))
47#define __printf0like__(fmtarg, firstvararg) \
48 __attribute__((__format__(__printf0__, fmtarg, firstvararg)))
49
50/*
51 * FreeBSD GCC implements printf0 that allows the format string to
52 * be a NULL pointer.
53 */
54#if __FreeBSD_cc_version < 300001
55#undef __printf0like__
56#define __printf0like__ __printflike__
57#endif
58
59#define __scanflike__(fmtarg, firstvararg) \
60 __attribute__((__format__(__scanf__, fmtarg, firstvararg)))
61
62#endif /* GNUC */
63
64#if __GNUC__ > 3 || __GNUC__ == 3 && __GNUC_MINOR__ > 2
65/* GCC-3.3 or more */
66
67/* CSTYLED */
68#define UConst __attribute__ ((__used__)) const
69
70#else /* less than GNUC 3.3 */
71
72#define UConst const
73
74#endif /* less than GNUC 3.3 */
75
76#ifdef __PCC__
77/*
78 * Hack until pcc supports __attribute__ ((__used__))
79 */
80#ifdef UConst
81#undef UConst
82#define UConst const
83#endif
84#endif
85
86#ifdef __cplusplus
87}
88#endif
89
90#endif /* _SCHILY_CCOMDEFS_H */