]> code.delx.au - gnu-emacs/blobdiff - lisp/progmodes/cmacexp.el
Switch to recommended form of GPLv3 permissions notice.
[gnu-emacs] / lisp / progmodes / cmacexp.el
index 28d988961a604df5f95bf3bc3d9fb6f4ea8ff6f1..920b5c93ab6b03d3a7751bbb415d6d3e25a4e5e5 100644 (file)
@@ -1,17 +1,25 @@
 ;;; cmacexp.el --- expand C macros in a region
 
-;; Copyright (C) 1992, 1994, 1996, 2000 Free Software Foundation, Inc.
+;; Copyright (C) 1992, 1994, 1996, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
+;; Free Software Foundation, Inc.
 
 ;; Author: Francesco Potorti` <pot@gnu.org>
 ;; Adapted-By: ESR
 ;; Keywords: c
 
+;; Yoni Rabkin <yoni@rabkins.net> contacted the maintainer of this
+;; file, and the maintainer agreed that when a bug is filed in the
+;; Emacs bug reporting system against this file, a copy of the bug
+;; report be sent to the maintainer's email address. However, the
+;; maintainer prefers not to be the only person maintaining this file
+;; in future.
+
 ;; This file is part of GNU Emacs.
 
-;; GNU Emacs is free software; you can redistribute it and/or modify
+;; GNU Emacs is free software: you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 2, or (at your option)
-;; any later version.
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
 
 ;; GNU Emacs is distributed in the hope that it will be useful,
 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -19,9 +27,7 @@
 ;; GNU General Public License for more details.
 
 ;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs; see the file COPYING.  If not, write to the
-;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
+;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
 
 ;;; Commentary:
 
@@ -92,6 +98,9 @@
 
 (provide 'cmacexp)
 
+(defvar msdos-shells)
+
+
 (defgroup c-macro nil
   "Expand C macros in a region."
   :group 'c)
   :group 'c-macro)
 
 (defcustom c-macro-preprocessor
-  ;; Cannot rely on standard directory on MS-DOS to find CPP.  In
-  ;; fact, cannot rely on having cpp.exe, either, in latest GCC
-  ;; versions.
-  (cond ((eq system-type 'ms-dos) "gcc -E -C -o - -")
-       ;; Solaris has it in an unusual place.
+  (cond ;; Solaris has it in an unusual place.
        ((and (string-match "^[^-]*-[^-]*-\\(solaris\\|sunos5\\)"
                            system-configuration)
              (file-exists-p "/opt/SUNWspro/SC3.0.1/bin/acomp"))
         "/opt/SUNWspro/SC3.0.1/bin/acomp -C -E")
-        ((file-exists-p "/usr/ccs/lib/cpp") "/usr/ccs/lib/cpp -C")
-       ((memq system-type '(darwin berkeley-unix)) "gcc -E -C -")
-       (t "/lib/cpp -C"))
+        ((locate-file "/usr/ccs/lib/cpp"
+                     '("/") exec-suffixes 'file-executable-p)
+        "/usr/ccs/lib/cpp -C")
+       ((locate-file "/lib/cpp"
+                     '("/") exec-suffixes 'file-executable-p)
+        "/lib/cpp -C")
+       ;; On some systems, we cannot rely on standard directories to
+       ;; find CPP.  In fact, we cannot rely on having cpp, either,
+       ;; in some GCC versions.
+       ((locate-file "cpp" exec-path exec-suffixes 'file-executable-p)
+        "cpp -C")
+       (t "gcc -E -C -o - -"))
   "The preprocessor used by the cmacexp package.
 
 If you change this, be sure to preserve the `-C' (don't strip comments)
@@ -141,8 +155,9 @@ Normally display output in temp buffer, but
 prefix arg means replace the region with it.
 
 `c-macro-preprocessor' specifies the preprocessor to use.
-Prompt for arguments to the preprocessor \(e.g. `-DDEBUG -I ./include')
-if the user option `c-macro-prompt-flag' is non-nil.
+Tf the user option `c-macro-prompt-flag' is non-nil
+prompt for arguments to the preprocessor \(e.g. `-DDEBUG -I ./include'),
+otherwise use `c-macro-cppflags'.
 
 Noninteractive args are START, END, SUBST.
 For use inside Lisp programs, see also `c-macro-expansion'."
@@ -336,13 +351,13 @@ Optional arg DISPLAY non-nil means show messages in the echo area."
                    (format "\n#line %d \"%s\"\n" startlinenum filename)))
 
          ;; Call the preprocessor.
-         (if display (message mymsg))
+         (if display (message "%s" mymsg))
          (setq exit-status
                (call-process-region 1 (point-max)
                                     shell-file-name
                                     t (list t tempname) nil "-c"
                                     cppcommand))
-         (if display (message (concat mymsg "done")))
+         (if display (message "%s" (concat mymsg "done")))
          (if (= (buffer-size) 0)
              ;; Empty output is normal after a fatal error.
              (insert "\nPreprocessor produced no output\n")
@@ -388,5 +403,5 @@ Optional arg DISPLAY non-nil means show messages in the echo area."
       ;; Cleanup.
       (kill-buffer outbuf))))
 
-;;; arch-tag: 4f20253c-71ef-4e6d-a774-19087060910e
+;; arch-tag: 4f20253c-71ef-4e6d-a774-19087060910e
 ;;; cmacexp.el ends here