aboutsummaryrefslogtreecommitdiffstats
path: root/epan/gnuc_format_check.h
blob: 31dcbeea893847740ee30d4c2415dd8f9e9d829a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/* gnuc_format_check.h
 * Definitions of macro to conditionally do GCC format checks
 *
 * $Id$
 *
 * Ethereal - Network traffic analyzer
 * By Gerald Combs <gerald@ethereal.com>
 * Copyright 1998 Gerald Combs
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 */

#ifndef __GNUC_FORMAT_CHECK_H__
#define __GNUC_FORMAT_CHECK_H__

/** GNUC has the ability to check format strings that follow the syntax used in printf and others.
 Hide the differences between different compilers in this GNUC_FORMAT_CHECK macro.
 @param archetype one of: printf, scanf, strftime or strfmon
 @param string_index specifies which argument is the format string argument (starting from 1)
 @param first_to_check is the number of the first argument to check against the format string */
#if __GNUC__ >= 2
	#define GNUC_FORMAT_CHECK(archetype, string_index, first_to_check) __attribute__((format (archetype, string_index, first_to_check)))
#else
	#define GNUC_FORMAT_CHECK(archetype, string_index, first_to_check)
#endif

#endif /* gnuc-format-check.h */