gkeating    03/02/12 16:11:24

  Modified:    live/gcc3/gcc diagnostic.c diagnostic.h toplev.c
  Log:
  Merge from FSF:
  2003-02-11  Geoffrey Keating  <[EMAIL PROTECTED]>
  
        * diagnostic.c (real_abort): New.
        (diagnostic_report_diagnostic): Call real_abort on error.
        * diagnostic.h (diagnostic_abort_on_error): New.
        (struct diagnostic_context): Add abort_on_error field.
        * toplev.c (setup_core_dumping): New.
        (decode_d_option): Handle 'H' case.
        * doc/invoke.texi (Debugging Options): Document -dH.
  
  Revision  Changes    Path
  1.36      +13 -0     src/live/gcc3/gcc/diagnostic.c
  
  Index: diagnostic.c
  ===================================================================
  RCS file: /cvs/Darwin/src/live/gcc3/gcc/diagnostic.c,v
  retrieving revision 1.35
  retrieving revision 1.36
  diff -u -r1.35 -r1.36
  --- diagnostic.c      2002/12/08 00:37:45     1.35
  +++ diagnostic.c      2003/02/13 00:11:22     1.36
  @@ -82,6 +82,7 @@
   
   static void error_recursion PARAMS ((diagnostic_context *)) ATTRIBUTE_NORETURN;
   static bool text_specifies_location PARAMS ((text_info *, location_t *));
  +static void real_abort PARAMS ((void)) ATTRIBUTE_NORETURN;
   
   extern int rtl_dump_and_exit;
   extern int warnings_are_errors;
  @@ -1327,6 +1328,8 @@
         output_flush (&context->buffer);
       }
   
  +  if (context->abort_on_error && diagnostic->kind <= DK_ERROR)
  +    real_abort();
     --context->lock;
   }
   
  @@ -1539,4 +1542,14 @@
         /* APPLE LOCAL unavailable */
        }
       }
  +}
  +
  +/* Really call the system 'abort'.  This has to go right at the end of
  +   this file, so that there are no functions after it that call abort
  +   and get the system abort instead of our macro.  */
  +#undef abort
  +static void 
  +real_abort ()
  +{
  +  abort ();
   }
  
  
  
  1.9       +9 -2      src/live/gcc3/gcc/diagnostic.h
  
  Index: diagnostic.h
  ===================================================================
  RCS file: /cvs/Darwin/src/live/gcc3/gcc/diagnostic.h,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- diagnostic.h      2002/10/24 23:42:53     1.8
  +++ diagnostic.h      2003/02/13 00:11:23     1.9
  @@ -1,5 +1,5 @@
   /* Various declarations for language-independent diagnostics subroutines.
  -   Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc.
  +   Copyright (C) 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
      Contributed by Gabriel Dos Reis <[EMAIL PROTECTED]>
   
   This file is part of GCC.
  @@ -190,6 +190,9 @@
        message, usually displayed once per compiler run.  */
     bool warnings_are_errors_message;
   
  +  /* True if we should raise a SIGABRT on errors.  */
  +  bool abort_on_error;
  +
     /* This function is called before any message is printed out.  It is
        responsible for preparing message prefix and such.  For example, it
        might say:
  @@ -259,12 +262,16 @@
   #define diagnostic_set_last_module(DC) \
     (DC)->last_module = input_file_stack_tick
   
  +/* Raise SIGABRT on any diagnostic of severity DK_ERROR or higher.  */
  +#define diagnostic_abort_on_error(DC) \
  +  (DC)->abort_on_error = true
  +
   /* This diagnostic_context is used by front-ends that directly output
      diagnostic messages without going through `error', `warning',
      and similar functions.  */
   extern diagnostic_context *global_dc;
   
  -/* The total count of a KIND of diagnostics meitted so far.  */
  +/* The total count of a KIND of diagnostics emitted so far.  */
   #define diagnostic_kind_count(DC, DK) (DC)->diagnostic_count[(int) (DK)]
   
   /* The number of errors that have been issued so far.  Ideally, these
  
  
  
  1.175     +27 -0     src/live/gcc3/gcc/toplev.c
  
  Index: toplev.c
  ===================================================================
  RCS file: /cvs/Darwin/src/live/gcc3/gcc/toplev.c,v
  retrieving revision 1.174
  retrieving revision 1.175
  diff -u -r1.174 -r1.175
  --- toplev.c  2003/02/12 22:28:30     1.174
  +++ toplev.c  2003/02/13 00:11:23     1.175
  @@ -117,6 +117,7 @@
   static void set_target_switch PARAMS ((const char *));
   
   static void crash_signal PARAMS ((int)) ATTRIBUTE_NORETURN;
  +static void setup_core_dumping PARAMS ((void));
   /* APPLE LOCAL interrupt signal handler (radar 2941633)  ilr */
   static void interrupt_signal PARAMS ((int)) ATTRIBUTE_NORETURN;
   static void set_float_handler PARAMS ((jmp_buf));
  @@ -1901,6 +1902,29 @@
   }
   /* APPLE LOCAL end interrupt signal handler */
   
  +/* Arrange to dump core on error.  (The regular error message is still
  +   printed first, except in the case of abort().)  */
  +
  +static void
  +setup_core_dumping ()
  +{
  +#ifdef SIGABRT
  +  signal (SIGABRT, SIG_DFL);
  +#endif
  +#if defined(HAVE_SETRLIMIT)
  +  {
  +    struct rlimit rlim;
  +    if (getrlimit (RLIMIT_CORE, &rlim) != 0)
  +      fatal_io_error ("getting core file size maximum limit");
  +    rlim.rlim_cur = rlim.rlim_max;
  +    if (setrlimit (RLIMIT_CORE, &rlim) != 0)
  +      fatal_io_error ("setting core file size limit to maximum");
  +  }
  +#endif
  +  diagnostic_abort_on_error (global_dc);
  +}
  +
  +
   /* Strip off a legitimate source ending from the input string NAME of
      length LEN.  Rather than having to know the names used by all of
      our front ends, we strip off an ending of a period followed by
  @@ -4163,6 +4187,9 @@
        break;
         case 'D':      /* These are handled by the preprocessor.  */
         case 'I':
  +     break;
  +      case 'H':
  +     setup_core_dumping();
        break;
   
         default:
  
  
  


Reply via email to