[3.4 PATCH] PR other/17361: C++ compiler options with .S

Roger Sayle roger@eyesopen.com
Thu Oct 14 18:40:00 GMT 2004


The following is a version of my recent mainline patch to allow C++
(and ObjC/ObjC++) command line options to be specified on the command
line when processing .S preprocessed assembly language files.  Unlike,
the original patch, which was approved by Neil, this version retains
(and even improves) g77 support on the release branch.

The following patch has been tested on i686-pc-linux-gnu with a full
"make bootstrap", all default languages, and regression tested with a
top-level "make -k check" with no new failures.

Ok for the gcc-3_4-branch?


2004-10-14  Roger Sayle  <roger@eyesopen.com>

	PR other/17361
	* c-opts.c (c_common_init_options): Scan command line options for
	"-lang-asm" and if found allow any of the C-family front-end options.
	Likewise, scan all command line options for g77's -traditional-cpp.


Index: c-opts.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-opts.c,v
retrieving revision 1.96.4.7
diff -c -3 -p -r1.96.4.7 c-opts.c
*** c-opts.c	18 Feb 2004 00:09:03 -0000	1.96.4.7
--- c-opts.c	14 Oct 2004 15:52:59 -0000
*************** defer_opt (enum opt_code code, const cha
*** 186,195 ****

  /* Common initialization before parsing options.  */
  unsigned int
! c_common_init_options (unsigned int argc, const char **argv ATTRIBUTE_UNUSED)
  {
    static const unsigned int lang_flags[] = {CL_C, CL_ObjC, CL_CXX, CL_ObjCXX};
!   unsigned int result;

    /* This is conditionalized only because that is the way the front
       ends used to do it.  Maybe this should be unconditional?  */
--- 186,195 ----

  /* Common initialization before parsing options.  */
  unsigned int
! c_common_init_options (unsigned int argc, const char **argv)
  {
    static const unsigned int lang_flags[] = {CL_C, CL_ObjC, CL_CXX, CL_ObjCXX};
!   unsigned int i, result;

    /* This is conditionalized only because that is the way the front
       ends used to do it.  Maybe this should be unconditional?  */
*************** c_common_init_options (unsigned int argc
*** 222,238 ****

    result = lang_flags[c_language];

!   /* If potentially preprocessing Fortran we have to accept its front
!      end options since the driver passes most of them through.  */
! #ifdef CL_F77
!   if (c_language == clk_c && argc > 2
!       && !strcmp (argv[2], "-traditional-cpp" ))
      {
!       permit_fortran_options = true;
!       result |= CL_F77;
!     }
  #endif
!
    return result;
  }

--- 222,246 ----

    result = lang_flags[c_language];

!   if (c_language == clk_c)
      {
!       for (i = 1; i < argc; i++)
! 	{
! 	  /* If preprocessing assembly language, accept any of the C-family
! 	     front end options since the driver may pass them through.  */
! 	  if (! strcmp (argv[i], "-lang-asm"))
! 	    result |= CL_C | CL_ObjC | CL_CXX | CL_ObjCXX;
! #ifdef CL_F77
! 	  /* If potentially preprocessing Fortran we have to accept its
! 	     front end options since the driver may them through.  */
! 	  else if (! strcmp (argv[i], "-traditional-cpp"))
! 	    {
! 	      permit_fortran_options = true;
! 	      result |= CL_F77;
! 	    }
  #endif
! 	}
!     }
    return result;
  }


Roger
--
Roger Sayle,                         E-mail: roger@eyesopen.com
OpenEye Scientific Software,         WWW: http://www.eyesopen.com/
Suite 1107, 3600 Cerrillos Road,     Tel: (+1) 505-473-7385
Santa Fe, New Mexico, 87507.         Fax: (+1) 505-473-0833



More information about the Gcc-patches mailing list