Skip to content

Commit

Permalink
Providing a mechanism in Overridable to prevent additional comments (p…
Browse files Browse the repository at this point in the history
…roject-chip#821)

- adding no_warning option in overridable.atomicType so that /* TYPE WARNING: */ message does not get generated because if this helper is used within a comments section of the code then compiler will throw an error
- Bumping the feature level
- JIRA: ZAPP-991
  • Loading branch information
brdandu authored Nov 18, 2022
1 parent aa61983 commit 853219d
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
2 changes: 1 addition & 1 deletion apack.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "Graphical configuration tool for application and libraries based on Zigbee Cluster Library.",
"path": [".", "node_modules/.bin/", "ZAP.app/Contents/MacOS"],
"requiredFeatureLevel": "apack.core:9",
"featureLevel": 85,
"featureLevel": 86,
"uc.triggerExtension": "zap",
"executable": {
"zap:win32.x86_64": {
Expand Down
11 changes: 8 additions & 3 deletions src-electron/generator/overridable.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,10 @@ function nonAtomicType(arg = { name: 'unknown', isStruct: false }) {
*
* @param {*} arg Object containing name and size
*/
function atomicType(arg = { name: 'unknown', size: 0 }) {
function atomicType(arg = { name: 'unknown', size: 0, no_warning: 0 }) {
let name = arg.name
let size = arg.size
let no_warning = arg.no_warning
if (name.startsWith('int')) {
let signed
if (name.endsWith('s')) signed = true
Expand Down Expand Up @@ -91,9 +92,13 @@ function atomicType(arg = { name: 'unknown', size: 0 }) {
case 'boolean':
return 'uint8_t'
case 'array':
return `/* TYPE WARNING: ${name} array defaults to */ uint8_t * `
return no_warning
? `uint8_t *`
: `/* TYPE WARNING: ${name} array defaults to */ uint8_t * `
default:
return `/* TYPE WARNING: ${name} defaults to */ uint8_t * `
return no_warning
? `uint8_t *`
: `/* TYPE WARNING: ${name} defaults to */ uint8_t * `
}
}
}
Expand Down
6 changes: 5 additions & 1 deletion src-electron/util/zcl-util.js
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,10 @@ function dataTypeHelper(
resolvedType,
overridable
) {
let no_warning = { no_warning: 0 }
if ('no_warning' in options.hash) {
no_warning = { no_warning: options.hash.no_warning }
}
switch (resolvedType) {
case dbEnum.zclType.array:
if ('array' in options.hash) {
Expand Down Expand Up @@ -577,7 +581,7 @@ function dataTypeHelper(
default:
return queryZcl
.selectAtomicType(db, packageIds, type)
.then((atomic) => overridable.atomicType(atomic))
.then((atomic) => overridable.atomicType({ ...atomic, ...no_warning }))
}
}

Expand Down

0 comments on commit 853219d

Please sign in to comment.