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]

Re: Patch to set prototype args for __builtin_{fwrite,fputc,fputs}



  In message <200012291623.LAA24009@caip.rutgers.edu>you write:
  > Currently, the fwrite, fputc and fputs builtins are declared with no
  > arguments.
  > 
  > This patch sets arguments for the prototypes of __builtin_fwrite,
  > __builtin_fputc and __builtin_fputs as:
  > 
  >  > extern size_t __builtin_fwrite(const void *, size_t, size_t, void *);
  >  > extern int __builtin_fputc(int, void *);
  >  > extern int __builtin_fputs(const char *, void *);
  > 
  > You'll notice that the stream argument is a void* instead of a FILE*.
  > This is the best we can do without major contortions to get the FILE
  > definition from stdio.h.  Using void* works just fine and is certainly
  > a step up from no arguments checks at all.
  > 
  > 
  > Regarding the non __builtin_ (i.e. regular) styles:
  > 
  > We currently don't set plain fwrite as a builtin, and this is
  > continued.  We did set plain fputc, but we don't need it, so I turned
  > that off.  (Both fwrite and fputc exist only to serve as placeholder
  > decls called from builtin fputs during transformations.)
  > 
  > The plain fputs builtin continues to get no arguments, but in typical
  > usage it merges with the prototype provided by stdio.h.  This allows
  > the stream argument to be properly set to FILE* for the regular call.
  > 
  > 
  > Bootstrap/testsuite run on solaris2.7, no problems.  Okay to install?
  > 
  > 		--Kaveh
  > 
  > 2000-12-29  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
  > 
  > 	* c-common.c (c_common_nodes_and_builtins): Set prototype
  > 	parameters for __builtin_fputs, __builtin_fputc and
  > 	__builtin_fwrite.  Don't declare plain fputc as a builtin.
  > 
  > testsuite:
  > 	* gcc.c-torture/execute/stdio-opt-1.c: Also test
  > 	__builtin_fputc and __builtin_fwrite.
Approved.  Please install.

Thanks,
jeff


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