public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* RF[AC]: Dollars in identifiers mess
@ 2002-07-21  2:28 Neil Booth
  2002-07-27 16:29 ` Richard Henderson
  0 siblings, 1 reply; 2+ messages in thread
From: Neil Booth @ 2002-07-21  2:28 UTC (permalink / raw)
  To: gcc-patches

I sent a mail about DOLLARS_IN_IDENTIFIERS about a year ago, but got
no reply.

I estimate that for 2 years now this has been completely ignored,
along with "-f{no-}dollars-in-identifiers", since the front ends
no longer determine whether dollars are permitted, and cpplib
has not recognized these options, nor the target macro.

The patch below does its best to get cpplib to DTRT, combining
existing cpplib semantics with what the front ends used to do.
However, I'm not really happy with it.

1) -$ does the same as -fdollars-in-identifiers.  I'd like to
   kill it, particularly as there is no option -no-$.  Does anyone
   use it?
2) Whether dollars are accepted depends on the std selected
   as well, and therefore the command line ordering of std=
   and -fdollars-in-identifiers.  The former will only allow
   dollars if the target macro says OK; the latter allows
   them regardless.  Ugh.

Should I instead just get rid of this mess altogether and always
allow $?  This has effectively been the reality for 2 years now.
Other ideas welcome.

Neil.

	* c-decl.c (dollars_in_ident): Remove.  Move default of
	DOLLARS_IN_IDENTIFIERS to defaults.h.
	(c_decode_option): Don't handle f{no-}dollars-in-identifiers.
	* ctree.h (dollars_in_ident): Remove.
	* cppinit.c (set_lang): Allow dollars only if target does.
	(OPT_TABLE): 2 new options.
	(cpp_handle_option): Handle them.
	* defaults.h (DOLLARS_IN_IDENTIFIERS): Default here.
cp:
	* cp-tree.h (dollars_in_ident): Remove.
	* decl2.c (dollars_in_ident): Remove.  Move default of
	DOLLARS_IN_IDENTIFIERS to defaults.h.
	(lang_f_options): Remove dollars-in-identifiers.

============================================================
Index: gcc/c-decl.c
*** gcc/c-decl.c	16 Jul 2002 02:16:31 -0000	1.338
--- gcc/c-decl.c	21 Jul 2002 08:30:58 -0000
*************** int warn_sign_compare = -1;
*** 420,432 ****
  
  int warn_float_equal = 0;
  
- /* Nonzero means `$' can be in an identifier.  */
- 
- #ifndef DOLLARS_IN_IDENTIFIERS
- #define DOLLARS_IN_IDENTIFIERS 1
- #endif
- int dollars_in_ident = DOLLARS_IN_IDENTIFIERS;
- 
  /* States indicating how grokdeclarator() should handle declspecs marked
     with __attribute__((deprecated)).  An object declared as
     __attribute__((deprecated)) suppresses warnings of uses of other
--- 420,425 ----
*************** c_decode_option (argc, argv)
*** 580,589 ****
        else
  	error ("unknown C standard `%s'", argstart);
      }
-   else if (!strcmp (p, "-fdollars-in-identifiers"))
-     dollars_in_ident = 1;
-   else if (!strcmp (p, "-fno-dollars-in-identifiers"))
-     dollars_in_ident = 0;
    else if (!strcmp (p, "-fsigned-char"))
      flag_signed_char = 1;
    else if (!strcmp (p, "-funsigned-char"))
--- 573,578 ----
============================================================
Index: gcc/c-tree.h
*** gcc/c-tree.h	16 Jul 2002 02:16:31 -0000	1.100
--- gcc/c-tree.h	21 Jul 2002 08:30:58 -0000
*************** extern int current_function_returns_abno
*** 317,326 ****
  
  extern int skip_evaluation;
  
- /* Nonzero means `$' can be in an identifier.  */
- 
- extern int dollars_in_ident;
- 
  /* Nonzero means allow type mismatches in conditional expressions;
     just make their values `void'.  */
  
--- 317,322 ----
============================================================
Index: gcc/cppinit.c
*** gcc/cppinit.c	20 Jul 2002 13:31:56 -0000	1.244
--- gcc/cppinit.c	21 Jul 2002 08:30:58 -0000
*************** set_lang (pfile, lang)
*** 423,429 ****
    CPP_OPTION (pfile, cplusplus)		 = l->cplusplus;
    CPP_OPTION (pfile, extended_numbers)	 = l->extended_numbers;
    CPP_OPTION (pfile, trigraphs)		 = l->trigraphs;
!   CPP_OPTION (pfile, dollars_in_ident)	 = l->dollars_in_ident;
    CPP_OPTION (pfile, cplusplus_comments) = l->cplusplus_comments;
    CPP_OPTION (pfile, digraphs)		 = l->digraphs;
  }
--- 423,430 ----
    CPP_OPTION (pfile, cplusplus)		 = l->cplusplus;
    CPP_OPTION (pfile, extended_numbers)	 = l->extended_numbers;
    CPP_OPTION (pfile, trigraphs)		 = l->trigraphs;
!   CPP_OPTION (pfile, dollars_in_ident)	 = (l->dollars_in_ident
! 					    && DOLLARS_IN_IDENTIFIERS);
    CPP_OPTION (pfile, cplusplus_comments) = l->cplusplus_comments;
    CPP_OPTION (pfile, digraphs)		 = l->digraphs;
  }
*************** new_pending_directive (pend, text, handl
*** 1176,1181 ****
--- 1177,1184 ----
    DEF_OPT("Wtrigraphs",               0,      OPT_Wtrigraphs)                 \
    DEF_OPT("Wundef",                   0,      OPT_Wundef)                     \
    DEF_OPT("d",                        no_arg, OPT_d)                          \
+   DEF_OPT("fdollars-in-identifiers",  0,      OPT_fdollars)		      \
+   DEF_OPT("fno-dollars-in-identifiers", 0,    OPT_fno_dollars)		      \
    DEF_OPT("fno-operator-names",       0,      OPT_fno_operator_names)         \
    DEF_OPT("fno-preprocessed",         0,      OPT_fno_preprocessed)           \
    DEF_OPT("fno-show-column",          0,      OPT_fno_show_column)            \
*************** cpp_handle_option (pfile, argc, argv)
*** 1360,1365 ****
--- 1363,1374 ----
        switch (opt_code)
  	{
  	case N_OPTS: /* Shut GCC up.  */
+ 	  break;
+ 	case OPT_fdollars:
+ 	  CPP_OPTION (pfile, dollars_in_ident) = 1;
+ 	  break;
+ 	case OPT_fno_dollars:
+ 	  CPP_OPTION (pfile, dollars_in_ident) = 0;
  	  break;
  	case OPT_fno_operator_names:
  	  CPP_OPTION (pfile, operator_names) = 0;
============================================================
Index: gcc/defaults.h
*** gcc/defaults.h	19 Jul 2002 23:11:18 -0000	1.81
--- gcc/defaults.h	21 Jul 2002 08:30:58 -0000
*************** Software Foundation, 59 Temple Place - S
*** 35,40 ****
--- 35,44 ----
  #  define TARGET_ESC 033
  #endif
  
+ #ifndef DOLLARS_IN_IDENTIFIERS
+ #  define DOLLARS_IN_IDENTIFIERS 1
+ #endif
+ 
  /* When removal of CPP_PREDEFINES is complete, TARGET_CPU_CPP_BULITINS
     can also be removed from here.  */
  #ifndef TARGET_OS_CPP_BUILTINS
============================================================
Index: gcc/cp/cp-tree.h
*** gcc/cp/cp-tree.h	10 Jul 2002 18:16:23 -0000	1.729
--- gcc/cp/cp-tree.h	21 Jul 2002 08:31:00 -0000
*************** extern GTY(()) tree global_namespace;
*** 933,942 ****
  #define ansi_assopname(CODE) \
    (assignment_operator_name_info[(int) (CODE)].identifier)
  
- /* Nonzero means `$' can be in an identifier.  */
- 
- extern int dollars_in_ident;
- 
  /* Nonzero means don't recognize the keyword `asm'.  */
  
  extern int flag_no_asm;
--- 933,938 ----
============================================================
Index: gcc/cp/decl2.c
*** gcc/cp/decl2.c	21 Jul 2002 02:07:01 -0000	1.546
--- gcc/cp/decl2.c	21 Jul 2002 08:31:01 -0000
*************** int warn_nontemplate_friend = 1;
*** 292,304 ****
  
  int warn_deprecated = 1;
  
- /* Nonzero means `$' can be in an identifier.  */
- 
- #ifndef DOLLARS_IN_IDENTIFIERS
- #define DOLLARS_IN_IDENTIFIERS 1
- #endif
- int dollars_in_ident = DOLLARS_IN_IDENTIFIERS;
- 
  /* C++ specific flags.  */   
  
  /* Nonzero means we should attempt to elide constructors when possible.  */
--- 292,297 ----
*************** lang_f_options[] =
*** 408,414 ****
    {"conserve-space", &flag_conserve_space, 1},
    {"const-strings", &flag_const_strings, 1},
    {"default-inline", &flag_default_inline, 1},
-   {"dollars-in-identifiers", &dollars_in_ident, 1},
    {"elide-constructors", &flag_elide_constructors, 1},
    {"enforce-eh-specs", &flag_enforce_eh_specs, 1},
    {"external-templates", &flag_external_templates, 1},
--- 401,406 ----

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: RF[AC]: Dollars in identifiers mess
  2002-07-21  2:28 RF[AC]: Dollars in identifiers mess Neil Booth
@ 2002-07-27 16:29 ` Richard Henderson
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Henderson @ 2002-07-27 16:29 UTC (permalink / raw)
  To: Neil Booth; +Cc: gcc-patches

On Sun, Jul 21, 2002 at 09:44:42AM +0100, Neil Booth wrote:
> 1) -$ does the same as -fdollars-in-identifiers.  I'd like to
>    kill it, particularly as there is no option -no-$.  Does anyone
>    use it?

Kill it.

> 2) Whether dollars are accepted depends on the std selected
>    as well, and therefore the command line ordering of std=
>    and -fdollars-in-identifiers.  The former will only allow
>    dollars if the target macro says OK; the latter allows
>    them regardless.  Ugh.

Blah.  I'd have expected -fdollars-in-identifiers to override
a standard setting.

> !   CPP_OPTION (pfile, dollars_in_ident)	 = (l->dollars_in_ident
> ! 					    && DOLLARS_IN_IDENTIFIERS);

Hum..  I'd think warning or erroring for a setting that is not
supported by the target is better than silently ignoring it.



r~

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-07-27 23:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-07-21  2:28 RF[AC]: Dollars in identifiers mess Neil Booth
2002-07-27 16:29 ` Richard Henderson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).