summaryrefslogtreecommitdiff
path: root/CC/EXPRESSIONS
diff options
context:
space:
mode:
authorOliver Reiche <oliver.reiche@huawei.com>2022-07-21 15:07:44 +0200
committerOliver Reiche <oliver.reiche@huawei.com>2022-07-25 11:34:45 +0200
commitd6ade68bc52d56467abdd7aee70c108902f4f0b2 (patch)
treeecd671fd67f1ddc8ffef26f45b7c4226e9d5f0a4 /CC/EXPRESSIONS
parent3da82010cea24fb8ed41ff88c5d8df8e086c5aa4 (diff)
downloadrules-cc-d6ade68bc52d56467abdd7aee70c108902f4f0b2.tar.gz
Rules: Enforce non-empty library and binary names
Diffstat (limited to 'CC/EXPRESSIONS')
-rw-r--r--CC/EXPRESSIONS18
1 files changed, 17 insertions, 1 deletions
diff --git a/CC/EXPRESSIONS b/CC/EXPRESSIONS
index b551787..462d219 100644
--- a/CC/EXPRESSIONS
+++ b/CC/EXPRESSIONS
@@ -405,7 +405,23 @@
]
, ["objects", {"type": "CALL_EXPRESSION", "name": "objects"}]
, [ "base name"
- , {"type": "join", "$1": {"type": "FIELD", "name": "name"}}
+ , { "type": "let*"
+ , "bindings":
+ [ [ "name"
+ , {"type": "join", "$1": {"type": "FIELD", "name": "name"}}
+ ]
+ ]
+ , "body":
+ { "type": "if"
+ , "cond": {"type": "var", "name": "objects"}
+ , "then":
+ { "type": "assert_non_empty"
+ , "msg": "A name has to be provided for non-header-only libraries"
+ , "$1": {"type": "var", "name": "name"}
+ }
+ , "else": {"type": "var", "name": "name"}
+ }
+ }
]
, [ "libname"
, { "type": "join"