aboutsummaryrefslogtreecommitdiffstats
path: root/epan/gnuc_format_check.h
diff options
context:
space:
mode:
authorguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>2005-09-13 04:00:47 +0000
committerguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>2005-09-13 04:00:47 +0000
commit1999e1d30fd2045ba0ff2b5fe47afc4aa3454030 (patch)
treeccbb4c7cee8f5d724b831c9a19315ecacd91de0b /epan/gnuc_format_check.h
parent9851cfbf1c1df8105231150fb50a87682bb22f8b (diff)
Move the definition of GNUC_FORMAT_CHECK() to its own header, use it in
column-utils.h, and add it to expert.h, so we check the arguments to "expert_add_info_format()", at least if the format argument is a constant string. Fix some more calls to "expert_add_info_format()" to pass it a format string. Don't record BoundsError exceptions as expert events - they merely reflect a capture done with a snapshot length too short to capture all of the packet (any case where it's caused by something else is a bug). git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@15776 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'epan/gnuc_format_check.h')
-rw-r--r--epan/gnuc_format_check.h39
1 files changed, 39 insertions, 0 deletions
diff --git a/epan/gnuc_format_check.h b/epan/gnuc_format_check.h
new file mode 100644
index 0000000000..31dcbeea89
--- /dev/null
+++ b/epan/gnuc_format_check.h
@@ -0,0 +1,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 */