This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

PATCH [C C++] new keywords for bounded pointers


This is first of about a dozen patches for bounded pointers.

OK to commit?

2000-03-10  Greg McGary  <gkm@gnu.org>

	* c-lex.h (enum rid): Add RID_BOUNDED & RID_UNBOUNDED.
	* c-lex.c (init_lex): Handle RID_BOUNDED & RID_UNBOUNDED.
	* c-parse.gperf (__bounded, __bounded__, __ptrbase, __ptrbase__,
	__ptrextent, __ptrextent__, __ptrvalue, __ptrvalue__,
	__unbounded, __unbounded__): New keywords.
	* c-parse.in (PTR_VALUE PTR_BASE PTR_EXTENT): New tokens.

cp:

2000-03-10  Greg McGary  <gkm@gnu.org>

	* lex.h (enum rid): Add RID_BOUNDED & RID_UNBOUNDED.
	* lex.c (init_parse): Handle RID_BOUNDED & RID_UNBOUNDED.
	* gxx.gperf (__bounded, __bounded__, __ptrbase, __ptrbase__,
	__ptrextent, __ptrextent__, __ptrvalue, __ptrvalue__,
	__unbounded, __unbounded__): New keywords.
	* parse.y (PTR_VALUE PTR_BASE PTR_EXTENT): New tokens.

Index: c-lex.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/c-lex.c,v
retrieving revision 1.77
diff -u -p -c -r1.77 c-lex.c
*** c-lex.c	2000/03/07 11:41:15	1.77
--- c-lex.c	2000/03/10 22:30:10
*************** init_lex ()
*** 305,310 ****
--- 305,312 ----
    ridpointers[(int) RID_CONST] = get_identifier ("const");
    ridpointers[(int) RID_RESTRICT] = get_identifier ("restrict");
    ridpointers[(int) RID_VOLATILE] = get_identifier ("volatile");
+   ridpointers[(int) RID_BOUNDED] = get_identifier ("__bounded");
+   ridpointers[(int) RID_UNBOUNDED] = get_identifier ("__unbounded");
    ridpointers[(int) RID_AUTO] = get_identifier ("auto");
    ridpointers[(int) RID_STATIC] = get_identifier ("static");
    ridpointers[(int) RID_EXTERN] = get_identifier ("extern");
Index: c-lex.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/c-lex.h,v
retrieving revision 1.12
diff -u -p -c -r1.12 c-lex.h
*** c-lex.h	2000/01/12 22:47:12	1.12
--- c-lex.h	2000/03/10 22:30:10
*************** enum rid
*** 42,47 ****
--- 42,49 ----
    RID_CONST,
    RID_RESTRICT,
    RID_VOLATILE,
+   RID_BOUNDED,
+   RID_UNBOUNDED,
    RID_INLINE,
    RID_NOALIAS,
    RID_ITERATOR,
Index: c-parse.gperf
===================================================================
RCS file: /cvs/gcc/egcs/gcc/c-parse.gperf,v
retrieving revision 1.9
diff -u -p -c -r1.9 c-parse.gperf
*** c-parse.gperf	1999/10/03 16:08:31	1.9
--- c-parse.gperf	2000/03/10 22:30:10
*************** __asm, ASM_KEYWORD, NORID
*** 29,34 ****
--- 29,36 ----
  __asm__, ASM_KEYWORD, NORID
  __attribute, ATTRIBUTE, NORID
  __attribute__, ATTRIBUTE, NORID
+ __bounded, TYPE_QUAL, RID_BOUNDED
+ __bounded__, TYPE_QUAL, RID_BOUNDED
  __builtin_va_arg, VA_ARG, NORID
  __complex, TYPESPEC, RID_COMPLEX
  __complex__, TYPESPEC, RID_COMPLEX
*************** __inline__, SCSPEC, RID_INLINE
*** 42,47 ****
--- 44,55 ----
  __iterator, SCSPEC, RID_ITERATOR
  __iterator__, SCSPEC, RID_ITERATOR
  __label__, LABEL, NORID
+ __ptrbase, PTR_BASE, NORID
+ __ptrbase__, PTR_BASE, NORID
+ __ptrextent, PTR_EXTENT, NORID
+ __ptrextent__, PTR_EXTENT, NORID
+ __ptrvalue, PTR_VALUE, NORID
+ __ptrvalue__, PTR_VALUE, NORID
  __real, REALPART, NORID
  __real__, REALPART, NORID
  __restrict, TYPE_QUAL, RID_RESTRICT
*************** __signed, TYPESPEC, RID_SIGNED
*** 50,55 ****
--- 58,65 ----
  __signed__, TYPESPEC, RID_SIGNED
  __typeof, TYPEOF, NORID
  __typeof__, TYPEOF, NORID
+ __unbounded, TYPE_QUAL, RID_UNBOUNDED
+ __unbounded__, TYPE_QUAL, RID_UNBOUNDED
  __volatile, TYPE_QUAL, RID_VOLATILE
  __volatile__, TYPE_QUAL, RID_VOLATILE
  asm, ASM_KEYWORD, NORID
Index: c-parse.in
===================================================================
RCS file: /cvs/gcc/egcs/gcc/c-parse.in,v
retrieving revision 1.33
diff -u -p -c -r1.33 c-parse.in
*** c-parse.in	2000/02/26 05:54:31	1.33
--- c-parse.in	2000/03/10 22:30:12
*************** end ifc
*** 115,120 ****
--- 115,121 ----
  %token BREAK CONTINUE RETURN GOTO ASM_KEYWORD TYPEOF ALIGNOF
  %token ATTRIBUTE EXTENSION LABEL
  %token REALPART IMAGPART VA_ARG
+ %token PTR_VALUE PTR_BASE PTR_EXTENT
  
  /* Used in c-lex.c for parsing pragmas.  */
  %token END_OF_LINE
Index: cp/gxx.gperf
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/gxx.gperf,v
retrieving revision 1.12
diff -u -p -c -r1.12 gxx.gperf
*** gxx.gperf	1999/09/02 03:13:16	1.12
--- gxx.gperf	2000/03/10 22:30:12
*************** __inline, SCSPEC, RID_INLINE
*** 29,34 ****
--- 29,40 ----
  __inline__, SCSPEC, RID_INLINE
  __label__, LABEL, RID_UNUSED
  __null, CONSTANT, RID_NULL
+ __ptrbase, PTR_BASE, RID_UNUSED
+ __ptrbase__, PTR_BASE, RID_UNUSED
+ __ptrextent, PTR_EXTENT, RID_UNUSED
+ __ptrextent__, PTR_EXTENT, RID_UNUSED
+ __ptrvalue, PTR_VALUE, RID_UNUSED
+ __ptrvalue__, PTR_VALUE, RID_UNUSED
  __real, REALPART, RID_UNUSED
  __real__, REALPART, RID_UNUSED
  __restrict, CV_QUALIFIER, RID_RESTRICT
*************** __signed, TYPESPEC, RID_SIGNED
*** 37,42 ****
--- 43,52 ----
  __signed__, TYPESPEC, RID_SIGNED
  __typeof, TYPEOF, RID_UNUSED
  __typeof__, TYPEOF, RID_UNUSED
+ __bounded, CV_QUALIFIER, RID_BOUNDED /* These can't be alphabetized because that */
+ __bounded__, CV_QUALIFIER, RID_BOUNDED /* yields a duplicate-value error from gperf. */
+ __unbounded, CV_QUALIFIER, RID_UNBOUNDED
+ __unbounded__, CV_QUALIFIER, RID_UNBOUNDED
  __volatile, CV_QUALIFIER, RID_VOLATILE
  __volatile__, CV_QUALIFIER, RID_VOLATILE
  __wchar_t, TYPESPEC, RID_WCHAR  /* Unique to ANSI C++ */,
Index: cp/lex.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/lex.c,v
retrieving revision 1.184
diff -u -p -c -r1.184 lex.c
*** lex.c	2000/03/08 09:07:36	1.184
--- lex.c	2000/03/10 22:30:13
*************** init_parse (filename)
*** 750,755 ****
--- 750,757 ----
    ridpointers[(int) RID_CONST] = get_identifier ("const");
    ridpointers[(int) RID_RESTRICT] = get_identifier ("__restrict");
    ridpointers[(int) RID_VOLATILE] = get_identifier ("volatile");
+   ridpointers[(int) RID_BOUNDED] = get_identifier ("__bounded");
+   ridpointers[(int) RID_UNBOUNDED] = get_identifier ("__unbounded");
    ridpointers[(int) RID_AUTO] = get_identifier ("auto");
    ridpointers[(int) RID_STATIC] = get_identifier ("static");
    ridpointers[(int) RID_EXTERN] = get_identifier ("extern");
Index: cp/lex.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/lex.h,v
retrieving revision 1.11
diff -u -p -c -r1.11 lex.h
*** lex.h	2000/02/26 20:15:46	1.11
--- lex.h	2000/03/10 22:30:13
*************** enum rid
*** 66,71 ****
--- 66,73 ----
    RID_AUTO,
    RID_MUTABLE,
    RID_COMPLEX,
+   RID_BOUNDED,
+   RID_UNBOUNDED,
    RID_RESTRICT,
  
    RID_LAST_MODIFIER = RID_RESTRICT,
Index: cp/parse.y
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/parse.y,v
retrieving revision 1.168
diff -u -p -c -r1.168 parse.y
*** parse.y	2000/02/26 20:15:46	1.168
--- parse.y	2000/03/10 22:30:14
*************** cp_parse_init ()
*** 270,275 ****
--- 270,276 ----
  %token SIGOF
  %token ATTRIBUTE EXTENSION LABEL
  %token REALPART IMAGPART VA_ARG
+ %token PTR_VALUE PTR_BASE PTR_EXTENT
  
  /* the reserved words... C++ extensions */
  %token <ttype> AGGR

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]