summaryrefslogtreecommitdiff
path: root/lisp/cedet
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2021-12-01 22:59:35 -0500
committerStefan Monnier <monnier@iro.umontreal.ca>2021-12-01 22:59:35 -0500
commitaaf0e62048e9d19d9ec6c403b45ab4a878df512c (patch)
treefb4414b4cf5f74d1a4485d4277e7626d8c083405 /lisp/cedet
parentc6dd8dd22338fddb68a8284a63302c712824f598 (diff)
downloademacs-aaf0e62048e9d19d9ec6c403b45ab4a878df512c.tar.gz
emacs-aaf0e62048e9d19d9ec6c403b45ab4a878df512c.tar.bz2
emacs-aaf0e62048e9d19d9ec6c403b45ab4a878df512c.zip
* lisp/cedet/semantic/bovine/c.el (semantic-tag-protection): Silence warning
We used to get cedet/semantic/bovine/c.el:1462:25: Warning: value returned from (string= s "static") is unused * lisp/cedet/semantic/bovine/c.el (semantic-tag-protection): Merge two `when` into an `if` and set `prot` instead of throwing away a result. Use `pcase` while we're at it.
Diffstat (limited to 'lisp/cedet')
-rw-r--r--lisp/cedet/semantic/bovine/c.el40
1 files changed, 18 insertions, 22 deletions
diff --git a/lisp/cedet/semantic/bovine/c.el b/lisp/cedet/semantic/bovine/c.el
index c7d59def1f1..19e2fee2bac 100644
--- a/lisp/cedet/semantic/bovine/c.el
+++ b/lisp/cedet/semantic/bovine/c.el
@@ -1466,36 +1466,32 @@ Override function for `semantic-tag-protection'."
(prot nil))
;; Check the modifiers for protection if we are not a child
;; of some class type.
- (when (or (not parent) (not (eq (semantic-tag-class parent) 'type)))
- (while (and (not prot) mods)
- (if (stringp (car mods))
- (let ((s (car mods)))
- ;; A few silly defaults to get things started.
- (cond ((or (string= s "extern")
- (string= s "export"))
- 'public)
- ((string= s "static")
- 'private))))
- (setq mods (cdr mods))))
- ;; If we have a typed parent, look for :public style labels.
- (when (and parent (eq (semantic-tag-class parent) 'type))
+ (if (not (and parent (eq (semantic-tag-class parent) 'type)))
+ (while (and (not prot) mods)
+ (if (stringp (car mods))
+ (let ((s (car mods)))
+ ;; A few silly defaults to get things started.
+ (setq prot (pcase s
+ ((or "extern" "export") 'public)
+ ("static" 'private)))))
+ (setq mods (cdr mods)))
+ ;; If we have a typed parent, look for :public style labels.
(let ((pp (semantic-tag-type-members parent)))
(while (and pp (not (semantic-equivalent-tag-p (car pp) tag)))
(when (eq (semantic-tag-class (car pp)) 'label)
(setq prot
- (cond ((string= (semantic-tag-name (car pp)) "public")
- 'public)
- ((string= (semantic-tag-name (car pp)) "private")
- 'private)
- ((string= (semantic-tag-name (car pp)) "protected")
- 'protected)))
+ (pcase (semantic-tag-name (car pp))
+ ("public" 'public)
+ ("private" 'private)
+ ("protected" 'protected)))
)
(setq pp (cdr pp)))))
(when (and (not prot) (eq (semantic-tag-class parent) 'type))
(setq prot
- (cond ((string= (semantic-tag-type parent) "class") 'private)
- ((string= (semantic-tag-type parent) "struct") 'public)
- (t 'unknown))))
+ (pcase (semantic-tag-type parent)
+ ("class" 'private)
+ ("struct" 'public)
+ (_ 'unknown))))
(or prot
(if (and parent (semantic-tag-of-class-p parent 'type))
'public