openbsd-ports/lang/gcc/3.3/patches/patch-gcc_builtin-attrs_def
2005-01-03 15:21:26 +00:00

79 lines
3.4 KiB
Plaintext

$OpenBSD: patch-gcc_builtin-attrs_def,v 1.1.1.1 2005/01/03 15:21:29 espie Exp $
--- gcc/builtin-attrs.def.orig Tue Mar 4 15:37:20 2003
+++ gcc/builtin-attrs.def Mon Jan 3 10:17:41 2005
@@ -71,13 +71,18 @@ DEF_ATTR_FOR_INT (4)
CONCAT2 (ATTR_,VALUE1), CONCAT2 (ATTR_LIST_,VALUE2))
DEF_LIST_INT_INT (1,0)
DEF_LIST_INT_INT (1,2)
+DEF_LIST_INT_INT (1,3)
DEF_LIST_INT_INT (2,0)
DEF_LIST_INT_INT (2,3)
DEF_LIST_INT_INT (3,0)
+DEF_LIST_INT_INT (3,2)
DEF_LIST_INT_INT (3,4)
+DEF_LIST_INT_INT (1,3_2)
#undef DEF_LIST_INT_INT
/* Construct tress for identifiers. */
+DEF_ATTR_IDENT (ATTR_BOUNDED, "bounded")
+DEF_ATTR_IDENT (ATTR_BUFFER, "buffer")
DEF_ATTR_IDENT (ATTR_CONST, "const")
DEF_ATTR_IDENT (ATTR_FORMAT, "format")
DEF_ATTR_IDENT (ATTR_FORMAT_ARG, "format_arg")
@@ -88,7 +93,9 @@ DEF_ATTR_IDENT (ATTR_NOTHROW, "nothrow")
DEF_ATTR_IDENT (ATTR_PRINTF, "printf")
DEF_ATTR_IDENT (ATTR_PURE, "pure")
DEF_ATTR_IDENT (ATTR_SCANF, "scanf")
+DEF_ATTR_IDENT (ATTR_SIZE, "size")
DEF_ATTR_IDENT (ATTR_STRFMON, "strfmon")
+DEF_ATTR_IDENT (ATTR_STRING, "string")
DEF_ATTR_IDENT (ATTR_STRFTIME, "strftime")
DEF_ATTR_TREE_LIST (ATTR_NOTHROW_LIST, ATTR_NOTHROW, ATTR_NULL, ATTR_NULL)
@@ -136,6 +143,45 @@ DEF_FORMAT_ATTRIBUTE(STRFMON,3,3_4)
DEF_FORMAT_ARG_ATTRIBUTE(1)
DEF_FORMAT_ARG_ATTRIBUTE(2)
#undef DEF_FORMAT_ARG_ATTRIBUTE
+
+/* Construct a tree for a bounded attribute. */
+
+/* Generate a fragment for future use in a bounded attr, e.g. ATTR_BUFFER_2_3 */
+#define DEF_ATTR_BOUNDED_FRAG(TYPE, VALUES) \
+ DEF_ATTR_TREE_LIST (CONCAT4 (ATTR_,TYPE,_,VALUES), ATTR_NULL, \
+ CONCAT2 (ATTR_,TYPE), CONCAT2 (ATTR_LIST_,VALUES))
+/* Create bounded attribute chained to nothrow, e.g. of the
+ form ATTR_NOTHROW_BOUNDED_BUFFER_2_3 */
+#define DEF_NOTHROW_BOUNDED_ATTRIBUTE(TYPE, VALUES) \
+ DEF_ATTR_TREE_LIST (CONCAT4 (ATTR_NOTHROW_BOUNDED_,TYPE,_,VALUES), ATTR_BOUNDED, \
+ CONCAT4 (ATTR_,TYPE,_,VALUES), ATTR_NOTHROW_LIST)
+/* Chain multiple nothrow bounded buffer attributes together */
+#define DEF_MULTIPLE_NOTHROW_BOUNDED_BUFFER_ATTRIBUTE(VAL1,VAL2) \
+ DEF_ATTR_TREE_LIST (CONCAT4(ATTR_NOTHROW_BOUNDED_BUFFER_,VAL1,_,VAL2),ATTR_BOUNDED,\
+ CONCAT2(ATTR_BUFFER_,VAL1), \
+ CONCAT2(ATTR_NOTHROW_BOUNDED_BUFFER_,VAL2))
+/* Chain a bounded attribute to a format printf attribute */
+#define DEF_FORMAT_PRINTF_BOUNDED_ATTRIBUTE(TYPE, VALUES, PREPEND,PRINTVALS) \
+ DEF_ATTR_TREE_LIST (CONCAT4 (PREPEND,TYPE,_,VALUES), \
+ ATTR_BOUNDED, CONCAT4 (ATTR_,TYPE,_,VALUES), \
+ CONCAT2(ATTR_FORMAT_PRINTF_,PRINTVALS))
+DEF_ATTR_BOUNDED_FRAG(BUFFER,1_2)
+DEF_ATTR_BOUNDED_FRAG(BUFFER,1_3)
+DEF_ATTR_BOUNDED_FRAG(BUFFER,2_3)
+DEF_ATTR_BOUNDED_FRAG(SIZE,1_3_2)
+DEF_ATTR_BOUNDED_FRAG(STRING,1_2)
+DEF_NOTHROW_BOUNDED_ATTRIBUTE(BUFFER,1_2)
+DEF_NOTHROW_BOUNDED_ATTRIBUTE(BUFFER,1_3)
+DEF_NOTHROW_BOUNDED_ATTRIBUTE(BUFFER,2_3)
+DEF_NOTHROW_BOUNDED_ATTRIBUTE(SIZE,1_3_2)
+DEF_MULTIPLE_NOTHROW_BOUNDED_BUFFER_ATTRIBUTE(2_3,1_3)
+DEF_FORMAT_PRINTF_BOUNDED_ATTRIBUTE(STRING,1_2,ATTR_PRINTF_3_4_BOUNDED_,3_4)
+DEF_FORMAT_PRINTF_BOUNDED_ATTRIBUTE(STRING,1_2,ATTR_PRINTF_3_0_BOUNDED_,3_0)
+
+#undef DEF_ATTR_BOUNDED_FRAG
+#undef DEF_NOTHROW_BOUNDED_ATTRIBUTE
+#undef DEF_MULTIPLE_NOTHROW_BOUNDED_ATTRIBUTE
+#undef DEF_FORMAT_PRINTF_BOUNDED_ATTRIBUTE
/* Define an attribute for a function, along with the IDENTIFIER_NODE. */
#define DEF_FN_ATTR_IDENT(NAME, ATTRS, PREDICATE) \