This is the mail archive of the gcc-bugs@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]

c++/1940: No option for turning off reporting of mismatched "{" "}"



>Number:         1940
>Category:       c++
>Synopsis:       No option for turning off reporting of mismatched "{" "}"
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Sun Feb 11 16:36:00 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     Craig Southeren
>Release:        g++ 2.96 20000814 and later
>Organization:
>Environment:
Linux 2.2.14 kernel
>Description:
Gcc (since version 2.96) performs a check on every source 
file to ensure that every "{" is matched by a "}". This is
fine for most source files, but is not strictly required by either C or
C++.

  In any case, the OpenH323 project makes extensive use of 
the ability to start a class definition in one file, and 
then complete it in another file. We use the technique to 
provide a platform independent header for each class, which
is then completed by a file containing any platform
dependent declarations for that class.

  Our project contains hundreds of constructs of this type, and we
cannot easily change it as this point. Unfortunately, this 
warning cannot be disabled, so using any compiler after 
2.95.3 creates hundreds of lines of spurious warning per 
compilation unit.
~
>How-To-Repeat:
Download the OpenH323 source code from http://www.openh323.org
and compile with any 2.96 compiler
>Fix:
Find patch attached
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: text/plain; name="t.txt"
Content-Disposition: inline; filename="t.txt"

*** orig.decl2.c        Thu Aug 17 23:38:06 2000
--- decl2.c     Thu Aug 17 23:56:44 2000
*************** int warn_nontemplate_friend = 1;
*** 353,358 ****
--- 353,361 ----

  int warn_deprecated = 1;

+ /* Nonzero means warn about files with unmatched braces */
+ int warn_unmatched_braces = 1;
+
  /* Nonzero means `$' can be in an identifier.  */

  #ifndef DOLLARS_IN_IDENTIFIERS
*************** lang_decode_option (argc, argv)
*** 784,789 ****
--- 787,794 ----
        warn_nontemplate_friend = setting;
        else if (!strcmp (p, "deprecated"))
          warn_deprecated = setting;
+       else if (!strcmp (p, "unmatched-braces"))
+         warn_unmatched_braces = setting;
        else if (!strcmp (p, "comment"))
        ;                       /* cpp handles this one.  */
        else if (!strcmp (p, "comments"))


*** orig.lex.c  Thu Aug 17 23:38:57 2000
--- lex.c       Thu Aug 17 23:57:01 2000
*************** linenum:
*** 2265,2271 ****
              --pending_lang_change;
            }

!         if (indent_level != input_file_stack->indent_level)
            {
              warning_with_file_and_line
                (input_filename, lineno,
--- 2265,2271 ----
              --pending_lang_change;
            }

!         if (warn_unmatched_braces && (indent_level != input_file_stack->indent_level))
            {
              warning_with_file_and_line
                (input_filename, lineno,


*** orig.cp-tree.h      Fri Aug 18 00:27:09 2000
--- cp-tree.h   Fri Aug 18 00:27:12 2000
*************** extern int warn_multichar;
*** 3226,3231 ****
--- 3226,3235 ----
     flag_guiding_decls in do_friend. */
  extern int warn_nontemplate_friend;

+ /* Nonzero means warn about files with unmatched braces */
+ extern int warn_unmatched_braces;
+
+
  /* in c-common.c */
  extern void declare_function_name               PARAMS ((void));
  extern void decl_attributes                     PARAMS ((tree, tree, tree));


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