diff options
Diffstat (limited to 'lisp/progmodes/cc-defs.el')
-rw-r--r-- | lisp/progmodes/cc-defs.el | 201 |
1 files changed, 74 insertions, 127 deletions
diff --git a/lisp/progmodes/cc-defs.el b/lisp/progmodes/cc-defs.el index 536e6766261..4f79fa9b330 100644 --- a/lisp/progmodes/cc-defs.el +++ b/lisp/progmodes/cc-defs.el @@ -1,4 +1,4 @@ -;;; cc-defs.el --- compile time definitions for CC Mode +;;; cc-defs.el --- compile time definitions for CC Mode -*- lexical-binding: t -*- ;; Copyright (C) 1985, 1987, 1992-2021 Free Software Foundation, Inc. @@ -125,7 +125,7 @@ The result of the body appears to the compiler as a quoted constant. This variant works around bugs in `eval-when-compile' in various \(X)Emacs versions. See cc-defs.el for details." - + (declare (indent 0) (debug t)) (if c-inside-eval-when-compile ;; XEmacs 21.4.6 has a bug in `eval-when-compile' in that it ;; evaluates its body at macro expansion time if it's nested @@ -170,9 +170,7 @@ This variant works around bugs in `eval-when-compile' in various ;; constant that we eval. That otoh introduce a problem in ;; that a returned lambda expression doesn't get byte ;; compiled (even if `function' is used). - (eval '(let ((c-inside-eval-when-compile t)) ,@body))))) - - (put 'cc-eval-when-compile 'lisp-indent-hook 0)) + (eval '(let ((c-inside-eval-when-compile t)) ,@body)))))) ;;; Macros. @@ -181,6 +179,7 @@ This variant works around bugs in `eval-when-compile' in various ;; between the host [X]Emacsen." ;; The motivation for this macro is to avoid the irritating message ;; "function `mapcan' from cl package called at runtime" produced by Emacs. + (declare (debug t)) (cond ((and (fboundp 'mapcan) (subrp (symbol-function 'mapcan))) @@ -196,18 +195,21 @@ This variant works around bugs in `eval-when-compile' in various (defmacro c--set-difference (liszt1 liszt2 &rest other-args) ;; Macro to smooth out the renaming of `set-difference' in Emacs 24.3. + (declare (debug (form form &rest [symbolp form]))) (if (eq c--cl-library 'cl-lib) `(cl-set-difference ,liszt1 ,liszt2 ,@other-args) `(set-difference ,liszt1 ,liszt2 ,@other-args))) (defmacro c--intersection (liszt1 liszt2 &rest other-args) ;; Macro to smooth out the renaming of `intersection' in Emacs 24.3. + (declare (debug (form form &rest [symbolp form]))) (if (eq c--cl-library 'cl-lib) `(cl-intersection ,liszt1 ,liszt2 ,@other-args) `(intersection ,liszt1 ,liszt2 ,@other-args))) (eval-and-compile (defmacro c--macroexpand-all (form &optional environment) + (declare (debug t)) ;; Macro to smooth out the renaming of `cl-macroexpand-all' in Emacs 24.3. (if (fboundp 'macroexpand-all) `(macroexpand-all ,form ,environment) @@ -215,6 +217,7 @@ This variant works around bugs in `eval-when-compile' in various (defmacro c--delete-duplicates (cl-seq &rest cl-keys) ;; Macro to smooth out the renaming of `delete-duplicates' in Emacs 24.3. + (declare (debug (form &rest [symbolp form]))) (if (eq c--cl-library 'cl-lib) `(cl-delete-duplicates ,cl-seq ,@cl-keys) `(delete-duplicates ,cl-seq ,@cl-keys)))) @@ -222,6 +225,7 @@ This variant works around bugs in `eval-when-compile' in various (defmacro c-font-lock-flush (beg end) "Declare the region BEG...END's fontification as out-of-date. On XEmacs and older Emacsen, this refontifies that region immediately." + (declare (debug t)) (if (fboundp 'font-lock-flush) `(font-lock-flush ,beg ,end) `(font-lock-fontify-region ,beg ,end))) @@ -249,6 +253,7 @@ one of the following symbols: If the referenced position doesn't exist, the closest accessible point to it is returned. This function does not modify the point or the mark." + (declare (debug t)) (if (eq (car-safe position) 'quote) (let ((position (eval position))) (cond @@ -417,6 +422,7 @@ to it is returned. This function does not modify the point or the mark." (defmacro c-is-escaped (pos) ;; Are there an odd number of backslashes before POS? + (declare (debug t)) `(save-excursion (goto-char ,pos) (not (zerop (logand (skip-chars-backward "\\\\") 1))))) @@ -424,6 +430,7 @@ to it is returned. This function does not modify the point or the mark." (defmacro c-will-be-escaped (pos beg end) ;; Will the character after POS be escaped after the removal of (BEG END)? ;; It is assumed that (>= POS END). + (declare (debug t)) `(save-excursion (let ((-end- ,end) count) @@ -436,6 +443,7 @@ to it is returned. This function does not modify the point or the mark." (defmacro c-will-be-unescaped (beg) ;; Would the character after BEG be unescaped? + (declare (debug t)) `(save-excursion (let (count) (goto-char ,beg) @@ -446,6 +454,7 @@ to it is returned. This function does not modify the point or the mark." (defmacro c-next-single-property-change (position prop &optional object limit) ;; See the doc string for either of the defuns expanded to. + (declare (debug t)) (if (and c-use-extents (fboundp 'next-single-char-property-change)) ;; XEmacs >= 2005-01-25 @@ -455,6 +464,7 @@ to it is returned. This function does not modify the point or the mark." (defmacro c-previous-single-property-change (position prop &optional object limit) ;; See the doc string for either of the defuns expanded to. + (declare (debug t)) (if (and c-use-extents (fboundp 'previous-single-char-property-change)) ;; XEmacs >= 2005-01-25 @@ -474,6 +484,7 @@ to it is returned. This function does not modify the point or the mark." (defmacro c-set-region-active (activate) ;; Activate the region if ACTIVE is non-nil, deactivate it ;; otherwise. Covers the differences between Emacs and XEmacs. + (declare (debug t)) (if (fboundp 'zmacs-activate-region) ;; XEmacs. `(if ,activate @@ -483,6 +494,7 @@ to it is returned. This function does not modify the point or the mark." `(setq mark-active ,activate))) (defmacro c-set-keymap-parent (map parent) + (declare (debug t)) (cond ;; XEmacs ((cc-bytecomp-fboundp 'set-keymap-parents) @@ -495,6 +507,7 @@ to it is returned. This function does not modify the point or the mark." (defmacro c-delete-and-extract-region (start end) "Delete the text between START and END and return it." + (declare (debug t)) (if (cc-bytecomp-fboundp 'delete-and-extract-region) ;; Emacs 21.1 and later `(delete-and-extract-region ,start ,end) @@ -505,15 +518,16 @@ to it is returned. This function does not modify the point or the mark." (defmacro c-safe (&rest body) ;; safely execute BODY, return nil if an error occurred + (declare (indent 0) (debug t)) `(condition-case nil (progn ,@body) (error nil))) -(put 'c-safe 'lisp-indent-function 0) (defmacro c-int-to-char (integer) ;; In Emacs, a character is an integer. In XEmacs, a character is a ;; type distinct from an integer. Sometimes we need to convert integers to ;; characters. `c-int-to-char' makes this conversion, if necessary. + (declare (debug t)) (if (fboundp 'int-to-char) `(int-to-char ,integer) integer)) @@ -521,6 +535,7 @@ to it is returned. This function does not modify the point or the mark." (defmacro c-characterp (arg) ;; Return t when ARG is a character (XEmacs) or integer (Emacs), otherwise ;; return nil. + (declare (debug t)) (if (integerp ?c) `(integerp ,arg) `(characterp ,arg))) @@ -567,6 +582,7 @@ to it is returned. This function does not modify the point or the mark." ;; string opener, or after the introductory R of one. The match data is ;; overwritten. On success the opener's identifier will be (match-string ;; 1). Text properties on any characters are ignored. + (declare (debug t)) (if pos `(save-excursion (goto-char ,pos) @@ -628,6 +644,7 @@ If BODY makes a change that unconditionally is undone then wrap this macro inside `c-save-buffer-state'. That way the change can be done even when the buffer is read-only, and without interference from various buffer change hooks." + (declare (indent 0) (debug t)) `(let (-tnt-chng-keep -tnt-chng-state) (unwind-protect @@ -638,7 +655,6 @@ various buffer change hooks." -tnt-chng-state (c-tnt-chng-record-state) -tnt-chng-keep (progn ,@body)) (c-tnt-chng-cleanup -tnt-chng-keep -tnt-chng-state)))) -(put 'c-tentative-buffer-changes 'lisp-indent-function 0) (defun c-tnt-chng-record-state () ;; Used internally in `c-tentative-buffer-changes'. @@ -696,6 +712,7 @@ on the wrong side of LIMIT, it stays unchanged. Note that this function might do hidden buffer changes. See the comment at the start of cc-engine.el for more info." + (declare (debug t)) (if limit `(when (< (point) (or ,limit (point-max))) (save-restriction @@ -717,6 +734,7 @@ starts on the wrong side of LIMIT, it stays unchanged. Note that this function might do hidden buffer changes. See the comment at the start of cc-engine.el for more info." + (declare (debug t)) (if limit `(when (> (point) (or ,limit (point-min))) (save-restriction @@ -733,11 +751,13 @@ This is like `forward-sexp' except that it isn't interactive and does not do any user friendly adjustments of the point and that it isn't susceptible to user configurations such as disabling of signals in certain situations." + (declare (debug t)) (or count (setq count 1)) `(goto-char (scan-sexps (point) ,count))) (defmacro c-backward-sexp (&optional count) "See `c-forward-sexp' and reverse directions." + (declare (debug t)) (or count (setq count 1)) `(c-forward-sexp ,(if (numberp count) (- count) `(- ,count)))) @@ -747,6 +767,7 @@ for unbalanced parens. A limit for the search may be given. FROM is assumed to be on the right side of it." + (declare (debug t)) (let ((res (if (featurep 'xemacs) `(scan-lists ,from ,count ,depth nil t) `(c-safe (scan-lists ,from ,count ,depth))))) @@ -774,6 +795,7 @@ leave point unmoved. A LIMIT for the search may be given. The start position is assumed to be before it." + (declare (debug t)) `(let ((dest (c-safe-scan-lists ,(or pos '(point)) 1 0 ,limit))) (when dest (goto-char dest) dest))) @@ -784,6 +806,7 @@ leave point unmoved. A LIMIT for the search may be given. The start position is assumed to be after it." + (declare (debug t)) `(let ((dest (c-safe-scan-lists ,(or pos '(point)) -1 0 ,limit))) (when dest (goto-char dest) dest))) @@ -793,6 +816,7 @@ or nil if no such position exists. The point is used if POS is left out. A limit for the search may be given. The start position is assumed to be before it." + (declare (debug t)) `(c-safe-scan-lists ,(or pos '(point)) 1 1 ,limit)) (defmacro c-up-list-backward (&optional pos limit) @@ -801,6 +825,7 @@ or nil if no such position exists. The point is used if POS is left out. A limit for the search may be given. The start position is assumed to be after it." + (declare (debug t)) `(c-safe-scan-lists ,(or pos '(point)) -1 1 ,limit)) (defmacro c-down-list-forward (&optional pos limit) @@ -809,6 +834,7 @@ or nil if no such position exists. The point is used if POS is left out. A limit for the search may be given. The start position is assumed to be before it." + (declare (debug t)) `(c-safe-scan-lists ,(or pos '(point)) 1 -1 ,limit)) (defmacro c-down-list-backward (&optional pos limit) @@ -817,6 +843,7 @@ or nil if no such position exists. The point is used if POS is left out. A limit for the search may be given. The start position is assumed to be after it." + (declare (debug t)) `(c-safe-scan-lists ,(or pos '(point)) -1 -1 ,limit)) (defmacro c-go-up-list-forward (&optional pos limit) @@ -826,6 +853,7 @@ position exists, otherwise nil is returned and the point isn't moved. A limit for the search may be given. The start position is assumed to be before it." + (declare (debug t)) `(let ((dest (c-up-list-forward ,pos ,limit))) (when dest (goto-char dest) t))) @@ -836,6 +864,7 @@ position exists, otherwise nil is returned and the point isn't moved. A limit for the search may be given. The start position is assumed to be after it." + (declare (debug t)) `(let ((dest (c-up-list-backward ,pos ,limit))) (when dest (goto-char dest) t))) @@ -846,6 +875,7 @@ exists, otherwise nil is returned and the point isn't moved. A limit for the search may be given. The start position is assumed to be before it." + (declare (debug t)) `(let ((dest (c-down-list-forward ,pos ,limit))) (when dest (goto-char dest) t))) @@ -856,6 +886,7 @@ exists, otherwise nil is returned and the point isn't moved. A limit for the search may be given. The start position is assumed to be after it." + (declare (debug t)) `(let ((dest (c-down-list-backward ,pos ,limit))) (when dest (goto-char dest) t))) @@ -967,6 +998,7 @@ be after it." ;; point)? Always returns nil for languages which don't have Virtual ;; semicolons. ;; This macro might do hidden buffer changes. + (declare (debug t)) `(if c-at-vsemi-p-fn (funcall c-at-vsemi-p-fn ,@(if pos `(,pos))))) @@ -984,6 +1016,7 @@ be after it." (defmacro c-benign-error (format &rest args) ;; Formats an error message for the echo area and dings, i.e. like ;; `error' but doesn't abort. + (declare (debug t)) `(progn (message ,format ,@args) (ding))) @@ -993,18 +1026,19 @@ be after it." ;; way to execute code. ;; Maintainers' note: If TABLE is `c++-template-syntax-table', DON'T call ;; any forms inside this that call `c-parse-state'. !!!! + (declare (indent 1) (debug t)) `(let ((c-with-syntax-table-orig-table (syntax-table))) (unwind-protect (progn (set-syntax-table ,table) ,@code) (set-syntax-table c-with-syntax-table-orig-table)))) -(put 'c-with-syntax-table 'lisp-indent-function 1) (defmacro c-skip-ws-forward (&optional limit) "Skip over any whitespace following point. This function skips over horizontal and vertical whitespace and line continuations." + (declare (debug t)) (if limit `(let ((limit (or ,limit (point-max)))) (while (progn @@ -1026,6 +1060,7 @@ continuations." "Skip over any whitespace preceding point. This function skips over horizontal and vertical whitespace and line continuations." + (declare (debug t)) (if limit `(let ((limit (or ,limit (point-min)))) (while (progn @@ -1048,6 +1083,7 @@ continuations." "Return non-nil if the current CC Mode major mode is MODE. MODE is either a mode symbol or a list of mode symbols." + (declare (debug t)) (if c-langs-are-parametric ;; Inside a `c-lang-defconst'. `(c-lang-major-mode-is ,mode) @@ -1130,6 +1166,7 @@ MODE is either a mode symbol or a list of mode symbols." ;; 21) then it's assumed that the property is present on it. ;; ;; This macro does a hidden buffer change. + (declare (debug t)) (setq property (eval property)) (if (or c-use-extents (not (cc-bytecomp-boundp 'text-property-default-nonsticky))) @@ -1147,6 +1184,7 @@ MODE is either a mode symbol or a list of mode symbols." ;; Get the value of the given property on the character at POS if ;; it's been put there by `c-put-char-property'. PROPERTY is ;; assumed to be constant. + (declare (debug t)) (setq property (eval property)) (if c-use-extents ;; XEmacs. @@ -1177,6 +1215,7 @@ MODE is either a mode symbol or a list of mode symbols." ;; constant. ;; ;; This macro does a hidden buffer change. + (declare (debug t)) (setq property (eval property)) (cond (c-use-extents ;; XEmacs. @@ -1199,6 +1238,7 @@ MODE is either a mode symbol or a list of mode symbols." ;; Return the first position in the range [FROM to) where the text property ;; PROPERTY is set, or `most-positive-fixnum' if there is no such position. ;; PROPERTY should be a quoted constant. + (declare (debug t)) `(let ((-from- ,from) (-to- ,to) pos) (cond ((and (< -from- -to-) @@ -1220,6 +1260,7 @@ MODE is either a mode symbol or a list of mode symbols." ;; `syntax-table'. ;; ;; This macro does hidden buffer changes. + (declare (debug t)) (setq property (eval property)) (if c-use-extents ;; XEmacs. @@ -1239,6 +1280,7 @@ MODE is either a mode symbol or a list of mode symbols." (defmacro c-clear-syn-tab-properties (from to) ;; Remove all occurrences of the `syntax-table' and `c-fl-syn-tab' text ;; properties between FROM and TO. + (declare (debug t)) `(let ((-from- ,from) (-to- ,to)) (when (and c-min-syn-tab-mkr c-max-syn-tab-mkr @@ -1260,6 +1302,7 @@ LIMIT bounds the search. The comparison is done with `equal'. Leave point just after the character, and set the match data on this character, and return point. If VALUE isn't found, Return nil; point is then left undefined." + (declare (debug t)) `(let ((place (point))) (while (and @@ -1279,6 +1322,7 @@ LIMIT bounds the search. The comparison is done with `equal'. Leave point just before the character, set the match data on this character, and return point. If VALUE isn't found, Return nil; point is then left undefined." + (declare (debug t)) `(let ((place (point))) (while (and @@ -1322,6 +1366,7 @@ been put there by c-put-char-property. POINT remains unchanged." which have the value VALUE, as tested by `equal'. These properties are assumed to be over individual characters, having been put there by c-put-char-property. POINT remains unchanged." + (declare (debug t)) (if c-use-extents ;; XEmacs `(let ((-property- ,property)) @@ -1342,6 +1387,7 @@ PROPERTY must be a constant. Leave point just after the character, and set the match data on this character, and return point. If the search fails, return nil; point is then left undefined." + (declare (debug t)) `(let ((char-skip (concat "^" (char-to-string ,char))) (-limit- (or ,limit (point-max))) (-value- ,value)) @@ -1365,6 +1411,7 @@ PROPERTY must be a constant. Leave point just before the character, and set the match data on this character, and return point. If the search fails, return nil; point is then left undefined." + (declare (debug t)) `(let ((char-skip (concat "^" (char-to-string ,char))) (-limit- (or ,limit (point-min))) (-value- ,value)) @@ -1388,6 +1435,7 @@ PROPERTY must be a constant. Leave point just after the character, and set the match data on this character, and return point. If the search fails, return nil; point is then left undefined." + (declare (debug t)) `(let ((char-skip (concat "^" (char-to-string ,char))) (-limit- (or ,limit (point-max))) (-value- ,value)) @@ -1436,6 +1484,7 @@ by `equal'. These properties are assumed to be over individual characters, having been put there by c-put-char-property. POINT remains unchanged. Return the position of the first removed property, or nil." + (declare (debug t)) (if c-use-extents ;; XEmacs `(let ((-property- ,property) @@ -1459,6 +1508,7 @@ property, or nil." ;; `c-put-char-property' must be a constant. "Put the text property PROPERTY with value VALUE on characters with value CHAR in the region [FROM to)." + (declare (debug t)) `(let ((skip-string (concat "^" (list ,char))) (-to- ,to)) (save-excursion @@ -1481,6 +1531,7 @@ with value CHAR in the region [FROM to)." ;; Put an overlay/extent covering the given range in the current ;; buffer. It's currently undefined whether it's front/end sticky ;; or not. The overlay/extent object is returned. + (declare (debug t)) (if (cc-bytecomp-fboundp 'make-overlay) ;; Emacs. `(let ((ol (make-overlay ,from ,to))) @@ -1494,6 +1545,7 @@ with value CHAR in the region [FROM to)." (defmacro c-delete-overlay (overlay) ;; Deletes an overlay/extent object previously retrieved using ;; `c-put-overlay'. + (declare (debug t)) (if (cc-bytecomp-fboundp 'make-overlay) ;; Emacs. `(delete-overlay ,overlay) @@ -1501,80 +1553,6 @@ with value CHAR in the region [FROM to)." `(delete-extent ,overlay))) -;; Make edebug understand the macros. -;(eval-after-load "edebug" ; 2006-07-09: def-edebug-spec is now in subr.el. -; '(progn -(def-edebug-spec cc-eval-when-compile (&rest def-form)) -(def-edebug-spec c-font-lock-flush t) -(def-edebug-spec c--mapcan t) -(def-edebug-spec c--set-difference (form form &rest [symbolp form])) -(def-edebug-spec c--intersection (form form &rest [symbolp form])) -(def-edebug-spec c--delete-duplicates (form &rest [symbolp form])) -(def-edebug-spec c-point t) -(def-edebug-spec c-is-escaped t) -(def-edebug-spec c-will-be-escaped t) -(def-edebug-spec c-next-single-property-change t) -(def-edebug-spec c-delete-and-extract-region t) -(def-edebug-spec c-set-region-active t) -(def-edebug-spec c-set-keymap-parent t) -(def-edebug-spec c-safe t) -(def-edebug-spec c-int-to-char t) -(def-edebug-spec c-characterp t) -(def-edebug-spec c-save-buffer-state let*) -(def-edebug-spec c-tentative-buffer-changes t) -(def-edebug-spec c-forward-syntactic-ws t) -(def-edebug-spec c-backward-syntactic-ws t) -(def-edebug-spec c-forward-sexp t) -(def-edebug-spec c-backward-sexp t) -(def-edebug-spec c-safe-scan-lists t) -(def-edebug-spec c-go-list-forward t) -(def-edebug-spec c-go-list-backward t) -(def-edebug-spec c-up-list-forward t) -(def-edebug-spec c-up-list-backward t) -(def-edebug-spec c-down-list-forward t) -(def-edebug-spec c-down-list-backward t) -(def-edebug-spec c-go-up-list-forward t) -(def-edebug-spec c-go-up-list-backward t) -(def-edebug-spec c-go-down-list-forward t) -(def-edebug-spec c-go-down-list-backward t) -(def-edebug-spec c-at-vsemi-p t) -(def-edebug-spec c-add-syntax t) -(def-edebug-spec c-add-class-syntax t) -(def-edebug-spec c-benign-error t) -(def-edebug-spec c-with-syntax-table t) -(def-edebug-spec c-skip-ws-forward t) -(def-edebug-spec c-skip-ws-backward t) -(def-edebug-spec c-major-mode-is t) -(def-edebug-spec c-search-forward-char-property t) -(def-edebug-spec c-search-backward-char-property t) -(def-edebug-spec c-put-char-property t) -(def-edebug-spec c-put-syn-tab t) -(def-edebug-spec c-get-char-property t) -(def-edebug-spec c-clear-char-property t) -(def-edebug-spec c-clear-syn-tab t) -;;(def-edebug-spec c-min-property-position nil) ; invoked only by macros -(def-edebug-spec c-min-property-position t) ; Now invoked from functions (2019-07) -(def-edebug-spec c-clear-char-property-with-value t) -(def-edebug-spec c-clear-char-property-with-value-on-char t) -(def-edebug-spec c-put-char-properties-on-char t) -(def-edebug-spec c-clear-char-properties t) -(def-edebug-spec c-clear-syn-tab-properties t) -(def-edebug-spec c-with-extended-string-fences (form form body)) -(def-edebug-spec c-put-overlay t) -(def-edebug-spec c-delete-overlay t) -(def-edebug-spec c-mark-<-as-paren t) -(def-edebug-spec c-mark->-as-paren t) -(def-edebug-spec c-unmark-<->-as-paren t) -(def-edebug-spec c-with-<->-as-parens-suppressed (body)) -(def-edebug-spec c-self-bind-state-cache (body)) -(def-edebug-spec c-sc-scan-lists-no-category+1+1 t) -(def-edebug-spec c-sc-scan-lists-no-category+1-1 t) -(def-edebug-spec c-sc-scan-lists-no-category-1+1 t) -(def-edebug-spec c-sc-scan-lists-no-category-1-1 t) -(def-edebug-spec c-sc-scan-lists t) -(def-edebug-spec c-sc-parse-partial-sexp t);)) - - ;;; Functions. ;; Note: All these after the macros, to be on safe side in avoiding @@ -1604,6 +1582,7 @@ with value CHAR in the region [FROM to)." ;; indirection through the `category' text property. This allows us to ;; toggle the property in all template brackets simultaneously and ;; cheaply. We use this, for instance, in `c-parse-state'. + (declare (debug t)) (if c-use-category `(c-put-char-property ,pos 'category 'c-<-as-paren-syntax) `(c-put-char-property ,pos 'syntax-table c-<-as-paren-syntax))) @@ -1618,6 +1597,7 @@ with value CHAR in the region [FROM to)." ;; indirection through the `category' text property. This allows us to ;; toggle the property in all template brackets simultaneously and ;; cheaply. We use this, for instance, in `c-parse-state'. + (declare (debug t)) (if c-use-category `(c-put-char-property ,pos 'category 'c->-as-paren-syntax) `(c-put-char-property ,pos 'syntax-table c->-as-paren-syntax))) @@ -1631,6 +1611,7 @@ with value CHAR in the region [FROM to)." ;; indirection through the `category' text property. This allows us to ;; toggle the property in all template brackets simultaneously and ;; cheaply. We use this, for instance, in `c-parse-state'. + (declare (debug t)) `(c-clear-char-property ,pos ,(if c-use-category ''category ''syntax-table))) (defsubst c-suppress-<->-as-parens () @@ -1651,50 +1632,13 @@ with value CHAR in the region [FROM to)." ;; Like progn, except that the paren property is suppressed on all ;; template brackets whilst they are running. This macro does a hidden ;; buffer change. + (declare (debug (body))) `(unwind-protect (progn (c-suppress-<->-as-parens) ,@forms) (c-restore-<->-as-parens))) -;;;;;;;;;;;;;;; - -(defmacro c-self-bind-state-cache (&rest forms) - ;; Bind the state cache to itself and execute the FORMS. Return the result - ;; of the last FORM executed. It is assumed that no buffer changes will - ;; happen in FORMS, and no hidden buffer changes which could affect the - ;; parsing will be made by FORMS. - `(let* ((c-state-cache (copy-tree c-state-cache)) - (c-state-cache-good-pos c-state-cache-good-pos) - ;(c-state-nonlit-pos-cache (copy-tree c-state-nonlit-pos-cache)) - ;(c-state-nonlit-pos-cache-limit c-state-nonlit-pos-cache-limit) - ;(c-state-semi-nonlit-pos-cache (copy-tree c-state-semi-nonlit-pos-cache)) - ;(c-state-semi-nonlit-pos-cache-limit c-state-semi-nonlit-pos-cache) - (c-state-brace-pair-desert (copy-tree c-state-brace-pair-desert)) - (c-state-point-min c-state-point-min) - (c-state-point-min-lit-type c-state-point-min-lit-type) - (c-state-point-min-lit-start c-state-point-min-lit-start) - (c-state-min-scan-pos c-state-min-scan-pos) - (c-state-old-cpp-beg-marker (if (markerp c-state-old-cpp-beg-marker) - (copy-marker c-state-old-cpp-beg-marker) - c-state-old-cpp-beg-marker)) - (c-state-old-cpp-beg (if (markerp c-state-old-cpp-beg) - c-state-old-cpp-beg-marker - c-state-old-cpp-beg)) - (c-state-old-cpp-end-marker (if (markerp c-state-old-cpp-end-marker) - (copy-marker c-state-old-cpp-end-marker) - c-state-old-cpp-end-marker)) - (c-state-old-cpp-end (if (markerp c-state-old-cpp-end) - c-state-old-cpp-end-marker - c-state-old-cpp-end)) - (c-parse-state-state c-parse-state-state)) - (prog1 - (progn ,@forms) - (if (markerp c-state-old-cpp-beg-marker) - (move-marker c-state-old-cpp-beg-marker nil)) - (if (markerp c-state-old-cpp-end-marker) - (move-marker c-state-old-cpp-end-marker nil))))) - ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; The following macros are to be used only in `c-parse-state' and its ;; subroutines. Their main purpose is to simplify the handling of C++/Java @@ -1708,6 +1652,7 @@ with value CHAR in the region [FROM to)." ;; Do a (scan-lists FROM 1 1). Any finishing position which either (i) is ;; determined by and angle bracket; or (ii) is inside a macro whose start ;; isn't POINT-MACRO-START doesn't count as a finishing position. + (declare (debug t)) `(let ((here (point)) (pos (scan-lists ,from 1 1))) (while (eq (char-before pos) ?>) @@ -1718,6 +1663,7 @@ with value CHAR in the region [FROM to)." ;; Do a (scan-lists FROM 1 -1). Any finishing position which either (i) is ;; determined by an angle bracket; or (ii) is inside a macro whose start ;; isn't POINT-MACRO-START doesn't count as a finishing position. + (declare (debug t)) `(let ((here (point)) (pos (scan-lists ,from 1 -1))) (while (eq (char-before pos) ?<) @@ -1729,6 +1675,7 @@ with value CHAR in the region [FROM to)." ;; Do a (scan-lists FROM -1 1). Any finishing position which either (i) is ;; determined by and angle bracket; or (ii) is inside a macro whose start ;; isn't POINT-MACRO-START doesn't count as a finishing position. + (declare (debug t)) `(let ((here (point)) (pos (scan-lists ,from -1 1))) (while (eq (char-after pos) ?<) @@ -1739,6 +1686,7 @@ with value CHAR in the region [FROM to)." ;; Do a (scan-lists FROM -1 -1). Any finishing position which either (i) is ;; determined by and angle bracket; or (ii) is inside a macro whose start ;; isn't POINT-MACRO-START doesn't count as a finishing position. + (declare (debug t)) `(let ((here (point)) (pos (scan-lists ,from -1 -1))) (while (eq (char-after pos) ?>) @@ -1747,6 +1695,7 @@ with value CHAR in the region [FROM to)." pos)) (defmacro c-sc-scan-lists (from count depth) + (declare (debug t)) (if c-use-category `(scan-lists ,from ,count ,depth) (cond @@ -1794,6 +1743,7 @@ with value CHAR in the region [FROM to)." (defmacro c-sc-parse-partial-sexp (from to &optional targetdepth stopbefore oldstate) + (declare (debug t)) (if c-use-category `(parse-partial-sexp ,from ,to ,targetdepth ,stopbefore ,oldstate) `(c-sc-parse-partial-sexp-no-category ,from ,to ,targetdepth ,stopbefore @@ -2354,6 +2304,7 @@ system." "Can be used inside a VAL in `c-lang-defconst' to evaluate FORM immediately, i.e. at the same time as the `c-lang-defconst' form itself is evaluated." + (declare (debug t)) ;; Evaluate at macro expansion time, i.e. in the ;; `c--macroexpand-all' inside `c-lang-defconst'. (eval form)) @@ -2396,7 +2347,8 @@ one `c-lang-defconst' for each NAME is permitted per file. If there already is one it will be completely replaced; the value in the earlier definition will not affect `c-lang-const' on the same constant. A file is identified by its base name." - + (declare (indent 1) + (debug (&define name [&optional stringp] [&rest sexp def-form]))) (let* ((sym (intern (symbol-name name) c-lang-constants)) ;; Make `c-lang-const' expand to a straightforward call to ;; `c-get-lang-constant' in `c--macroexpand-all' below. @@ -2487,12 +2439,6 @@ constant. A file is identified by its base name." (c-define-lang-constant ',name ,bindings ,@(and pre-files `(',pre-files)))))) -(put 'c-lang-defconst 'lisp-indent-function 1) -;(eval-after-load "edebug" ; 2006-07-09: def-edebug-spec is now in subr.el. -; ' -(def-edebug-spec c-lang-defconst - (&define name [&optional stringp] [&rest sexp def-form])) - (defun c-define-lang-constant (name bindings &optional pre-files) ;; Used by `c-lang-defconst'. @@ -2548,6 +2494,7 @@ LANG is the name of the language, i.e. the mode name without the language. NAME and LANG are not evaluated so they should not be quoted." + (declare (debug (name &optional symbolp))) (or (symbolp name) (error "Not a symbol: %S" name)) (or (symbolp lang) |