This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


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

Re: PATCH: gas .incbin pseudo-op


Hi Alan,

> fopen (path, "rb")
> 
> s/"rb"/FOPEN_RB/

Hmm, well as it turns out none of the calls to fopen in the gas
sources were using these macros, so I changed them all.  (Except for
gasp which was not including the appropriate header).  I have applied
the patch below.

Cheers
        Nick


2001-07-10  Nick Clifton  <nickc@cambridge.redhat.com>

	* depend.c: Use FOPEN_.. macros in calls to fopen().
	* input-file.c: As above.
	* itbl-ops.c: As above.
	* listing.c: As above.
	* output-file.c: As above.
	* read.c: As above.

Index: gas/depend.c
===================================================================
RCS file: /cvs/src/src/gas/depend.c,v
retrieving revision 1.4
diff -p -r1.4 depend.c
*** depend.c	2001/03/08 23:24:22	1.4
--- depend.c	2001/07/10 09:30:23
*************** print_dependencies ()
*** 190,196 ****
    if (dep_file == NULL)
      return;
  
!   f = fopen (dep_file, "w");
    if (f == NULL)
      {
        as_warn (_("Can't open `%s' for writing"), dep_file);
--- 190,196 ----
    if (dep_file == NULL)
      return;
  
!   f = fopen (dep_file, FOPEN_WT);
    if (f == NULL)
      {
        as_warn (_("Can't open `%s' for writing"), dep_file);
Index: gas/input-file.c
===================================================================
RCS file: /cvs/src/src/gas/input-file.c,v
retrieving revision 1.5
diff -p -r1.5 input-file.c
*** input-file.c	2001/03/08 23:24:22	1.5
--- input-file.c	2001/07/10 09:30:27
*************** input_file_open (filename, pre)
*** 140,146 ****
    assert (filename != 0);	/* Filename may not be NULL.  */
    if (filename[0])
      {				/* We have a file name. Suck it and see.  */
!       f_in = fopen (filename, "r");
        file_name = filename;
      }
    else
--- 140,146 ----
    assert (filename != 0);	/* Filename may not be NULL.  */
    if (filename[0])
      {				/* We have a file name. Suck it and see.  */
!       f_in = fopen (filename, FOPEN_RT);
        file_name = filename;
      }
    else
Index: gas/itbl-ops.c
===================================================================
RCS file: /cvs/src/src/gas/itbl-ops.c,v
retrieving revision 1.8
diff -p -r1.8 itbl-ops.c
*** itbl-ops.c	2001/05/03 02:07:01	1.8
--- itbl-ops.c	2001/07/10 09:30:27
*************** itbl_parse (char *insntbl)
*** 183,199 ****
  {
    extern FILE *yyin;
    extern int yyparse (void);
!   yyin = fopen (insntbl, "r");
    if (yyin == 0)
      {
        printf ("Can't open processor instruction specification file \"%s\"\n",
  	      insntbl);
        return 1;
      }
!   else
!     {
!       while (yyparse ());
!     }
    fclose (yyin);
    itbl_have_entries = 1;
    return 0;
--- 183,200 ----
  {
    extern FILE *yyin;
    extern int yyparse (void);
! 
!   yyin = fopen (insntbl, FOPEN_RT);
    if (yyin == 0)
      {
        printf ("Can't open processor instruction specification file \"%s\"\n",
  	      insntbl);
        return 1;
      }
! 
!   while (yyparse ())
!     ;
! 
    fclose (yyin);
    itbl_have_entries = 1;
    return 0;
Index: gas/listing.c
===================================================================
RCS file: /cvs/src/src/gas/listing.c,v
retrieving revision 1.14
diff -p -r1.14 listing.c
*** listing.c	2001/03/31 06:47:54	1.14
--- listing.c	2001/07/10 09:30:30
*************** buffer_line (file, line, size)
*** 485,491 ****
  	}
  
        last_open_file_info = file;
!       last_open_file = fopen (file->filename, "r");
        if (last_open_file == NULL)
  	{
  	  file->at_end = 1;
--- 485,491 ----
  	}
  
        last_open_file_info = file;
!       last_open_file = fopen (file->filename, FOPEN_RT);
        if (last_open_file == NULL)
  	{
  	  file->at_end = 1;
*************** listing_print (name)
*** 1121,1127 ****
      }
    else
      {
!       list_file = fopen (name, "w");
        if (list_file != NULL)
  	using_stdout = 0;
        else
--- 1121,1127 ----
      }
    else
      {
!       list_file = fopen (name, FOPEN_WT);
        if (list_file != NULL)
  	using_stdout = 0;
        else
Index: gas/output-file.c
===================================================================
RCS file: /cvs/src/src/gas/output-file.c,v
retrieving revision 1.3
diff -p -r1.3 output-file.c
*** output-file.c	2001/03/08 23:24:22	1.3
--- output-file.c	2001/07/10 09:30:30
*************** output_file_create (name)
*** 108,118 ****
        return;
      }
  
!   stdoutput = fopen (name, "wb");
  
    /* Some systems don't grok "b" in fopen modes.  */
    if (stdoutput == NULL)
!     stdoutput = fopen (name, "w");
  
    if (stdoutput == NULL)
      {
--- 108,118 ----
        return;
      }
  
!   stdoutput = fopen (name, FOPEN_WB);
  
    /* Some systems don't grok "b" in fopen modes.  */
    if (stdoutput == NULL)
!     stdoutput = fopen (name, FOPEN_W);
  
    if (stdoutput == NULL)
      {
Index: gas/read.c
===================================================================
RCS file: /cvs/src/src/gas/read.c,v
retrieving revision 1.42
diff -p -r1.42 read.c
*** read.c	2001/07/09 08:19:17	1.42
--- read.c	2001/07/10 09:30:34
*************** s_incbin (x)
*** 4950,4956 ****
    demand_empty_rest_of_line ();
  
    /* Try opening absolute path first, then try include dirs.  */
!   binfile = fopen (filename, "rb");
    if (binfile == NULL)
      {
        int i;
--- 4950,4956 ----
    demand_empty_rest_of_line ();
  
    /* Try opening absolute path first, then try include dirs.  */
!   binfile = fopen (filename, FOPEN_RB);
    if (binfile == NULL)
      {
        int i;
*************** s_incbin (x)
*** 4961,4967 ****
  	{
  	  sprintf (path, "%s/%s", include_dirs[i], filename);
  
! 	  binfile = fopen (path, "rb");
  	  if (binfile != NULL)
  	    break;
  	}
--- 4961,4967 ----
  	{
  	  sprintf (path, "%s/%s", include_dirs[i], filename);
  
! 	  binfile = fopen (path, FOPEN_RB);
  	  if (binfile != NULL)
  	    break;
  	}
*************** s_include (arg)
*** 5064,5070 ****
        strcpy (path, include_dirs[i]);
        strcat (path, "/");
        strcat (path, filename);
!       if (0 != (try = fopen (path, "r")))
  	{
  	  fclose (try);
  	  goto gotit;
--- 5066,5072 ----
        strcpy (path, include_dirs[i]);
        strcat (path, "/");
        strcat (path, filename);
!       if (0 != (try = fopen (path, FOPEN_RT)))
  	{
  	  fclose (try);
  	  goto gotit;


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