Move DONT_REOPEN_PTY from src/s to configure
[bpt/emacs.git] / src / emacs.c
index d3e8e44..2194cfe 100644 (file)
@@ -45,6 +45,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include "commands.h"
 #include "intervals.h"
+#include "character.h"
 #include "buffer.h"
 #include "window.h"
 
@@ -65,6 +66,12 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include "nsterm.h"
 #endif
 
+#if (defined PROFILING \
+     && (defined __FreeBSD__ || defined GNU_LINUX || defined __MINGW32__))
+# include <sys/gmon.h>
+extern void moncontrol (int mode);
+#endif
+
 #ifdef HAVE_X_WINDOWS
 #include "xterm.h"
 #endif
@@ -86,31 +93,24 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #define O_RDWR 2
 #endif
 
-#ifdef HAVE_SETPGID
-#if !defined (USG)
-#undef setpgrp
-#define setpgrp setpgid
-#endif
-#endif
-
 static const char emacs_version[] = VERSION;
 static const char emacs_copyright[] = "Copyright (C) 2012 Free Software Foundation, Inc.";
 
 /* Make these values available in GDB, which doesn't see macros.  */
 
-#ifdef USE_LSB_TAG
+#if USE_LSB_TAG
 int gdb_use_lsb EXTERNALLY_VISIBLE = 1;
 #else
 int gdb_use_lsb EXTERNALLY_VISIBLE = 0;
 #endif
-#ifndef USE_LISP_UNION_TYPE
-int gdb_use_union EXTERNALLY_VISIBLE  = 0;
+#ifndef CHECK_LISP_OBJECT_TYPE
+int gdb_use_struct EXTERNALLY_VISIBLE = 0;
 #else
-int gdb_use_union EXTERNALLY_VISIBLE = 1;
+int gdb_use_struct EXTERNALLY_VISIBLE = 1;
 #endif
 int gdb_valbits EXTERNALLY_VISIBLE = VALBITS;
 int gdb_gctypebits EXTERNALLY_VISIBLE = GCTYPEBITS;
-#if defined (DATA_SEG_BITS) && ! defined (USE_LSB_TAG)
+#if defined DATA_SEG_BITS && !USE_LSB_TAG
 uintptr_t gdb_data_seg_bits EXTERNALLY_VISIBLE = DATA_SEG_BITS;
 #else
 uintptr_t gdb_data_seg_bits EXTERNALLY_VISIBLE = 0;
@@ -119,7 +119,7 @@ ptrdiff_t PVEC_FLAG EXTERNALLY_VISIBLE = PSEUDOVECTOR_FLAG;
 ptrdiff_t gdb_array_mark_flag EXTERNALLY_VISIBLE = ARRAY_MARK_FLAG;
 /* GDB might say "No enum type named pvec_type" if we don't have at
    least one symbol with that type, and then xbacktrace could fail.  */
-enum pvec_type gdb_pvec_type EXTERNALLY_VISIBLE = PVEC_TYPE_MASK;
+enum pvec_type const gdb_pvec_type EXTERNALLY_VISIBLE = 0;
 
 /* Empty lisp strings.  To avoid having to build any others.  */
 Lisp_Object empty_unibyte_string, empty_multibyte_string;
@@ -320,9 +320,9 @@ pthread_t main_thread;
 #ifdef HAVE_NS
 /* NS autrelease pool, for memory management.  */
 static void *ns_pool;
-#endif  
+#endif
+
 
 
 /* Handle bus errors, invalid instruction, etc.  */
 #ifndef FLOAT_CATCH_SIGILL
@@ -569,7 +569,7 @@ static char dump_tz[] = "UtC0";
 /* Define a dummy function F.  Declare F too, to pacify gcc
    -Wmissing-prototypes.  */
 #define DEFINE_DUMMY_FUNCTION(f) \
-  void f (void) EXTERNALLY_VISIBLE; void f (void) {}
+  void f (void) ATTRIBUTE_CONST EXTERNALLY_VISIBLE; void f (void) {}
 
 #ifndef GCC_CTORS_IN_LIBC
 DEFINE_DUMMY_FUNCTION (__do_global_ctors)
@@ -1426,13 +1426,6 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem
   init_ntproc ();      /* must precede init_editfns.  */
 #endif
 
-#ifdef HAVE_NS
-#ifndef CANNOT_DUMP
-  if (initialized)
-#endif
-    ns_init_paths ();
-#endif
-
   /* Initialize and GC-protect Vinitial_environment and
      Vprocess_environment before set_initial_environment fills them
      in.  */
@@ -1664,32 +1657,14 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem
 #ifdef PROFILING
   if (initialized)
     {
-      extern void _mcleanup ();
 #ifdef __MINGW32__
       extern unsigned char etext asm ("etext");
 #else
       extern char etext;
 #endif
-#ifdef HAVE___EXECUTABLE_START
-      /* This symbol is defined by GNU ld to the start of the text
-        segment.  */
-      extern char __executable_start[];
-#else
-      extern void safe_bcopy ();
-#endif
 
       atexit (_mcleanup);
-#ifdef HAVE___EXECUTABLE_START
-      monstartup (__executable_start, &etext);
-#else
-      /* This uses safe_bcopy because that function comes first in the
-        Emacs executable.  It might be better to use something that
-        gives the start of the text segment, but start_of_text is not
-        defined on all systems now.  */
-      /* FIXME: Does not work on architectures with function
-        descriptors.  */
-      monstartup (safe_bcopy, &etext);
-#endif
+      monstartup ((uintptr_t) __executable_start, (uintptr_t) &etext);
     }
   else
     moncontrol (0);
@@ -1838,7 +1813,7 @@ static const struct standard_args standard_args[] =
 static void
 sort_args (int argc, char **argv)
 {
-  char **new = (char **) xmalloc (sizeof (char *) * argc);
+  char **new = xmalloc (argc * sizeof *new);
   /* For each element of argv,
      the corresponding element of options is:
      0 for an option that takes no arguments,