1 ;;; semantic-alias.el --- kludge for making aliases and autoloads work
4 ;;; Copyright (C) 2007 Mike Sperber
6 ;; This file is not part of GNU Emacs.
8 ;; Semantic is free software; you can redistribute it and/or modify
9 ;; it under the terms of the GNU General Public License as published by
10 ;; the Free Software Foundation; either version 2, or (at your option)
13 ;; This software is distributed in the hope that it will be useful,
14 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 ;; GNU General Public License for more details.
18 ;; You should have received a copy of the GNU General Public License
19 ;; along with GNU Emacs; see the file COPYING. If not, write to the
20 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 ;; Boston, MA 02110-1301, USA.
23 (provide 'semantic-alias)
25 ;;; Obsoleting various functions & variables
28 ;;;###autoloadimmediate
29 (defalias 'semantic-compile-warn
31 (if (fboundp 'byte-compile-warn)
35 ;;;###autoloadimmediate
36 (defun semantic-overload-symbol-from-function (name)
37 "Return the symbol for overload used by NAME, the defined symbol."
38 (let ((sym-name (symbol-name name)))
39 (if (string-match "^semantic-" sym-name)
40 (intern (substring sym-name (match-end 0)))
43 ;;;###autoloadimmediate
44 (defun semantic-alias-obsolete (oldfnalias newfn)
45 "Make OLDFNALIAS an alias for NEWFN.
46 Mark OLDFNALIAS as obsolete, such that the byte compiler
47 will throw a warning when it encounters this symbol."
48 (defalias oldfnalias newfn)
49 (make-obsolete oldfnalias newfn)
50 (when (and (function-overload-p newfn)
51 (not (overload-obsoleted-by newfn))
52 ;; Only throw this warning when byte compiling things.
53 (boundp 'byte-compile-current-file)
54 byte-compile-current-file
55 (not (string-match "cedet" byte-compile-current-file))
57 (make-obsolete-overload oldfnalias newfn)
58 (semantic-compile-warn
59 "%s: `%s' obsoletes overload `%s'"
60 byte-compile-current-file
62 (semantic-overload-symbol-from-function oldfnalias))
65 ;;;###autoloadimmediate
66 (defun semantic-varalias-obsolete (oldvaralias newvar)
67 "Make OLDVARALIAS an alias for variable NEWVAR.
68 Mark OLDVARALIAS as obsolete, such that the byte compiler
69 will throw a warning when it encounters this symbol."
70 (make-obsolete-variable oldvaralias newvar)
72 (defvaralias oldvaralias newvar)
74 ;; Only throw this warning when byte compiling things.
75 (when (and (boundp 'byte-compile-current-file)
76 byte-compile-current-file)
77 (semantic-compile-warn
78 "variable `%s' obsoletes, but isn't alias of `%s'"