-
Notifications
You must be signed in to change notification settings - Fork 20
Fix(ui): Avoid ERROR macro conflict in iconcodes #48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -31,8 +31,8 @@ | |
| #ifdef INFO | ||
| #undef INFO | ||
| #endif | ||
| #ifdef ERROR | ||
| #undef ERROR | ||
| #ifdef ERROR_ICON | ||
| #undef ERROR_ICON | ||
| #endif | ||
| #ifdef QUESTION | ||
| #undef QUESTION | ||
|
|
@@ -340,7 +340,7 @@ enum class Code : char16_t { | |
|
|
||
| WARNING = 0xF3CE, | ||
| INFO = 0xF3CF, | ||
| ERROR = 0xF3D0, | ||
| ERROR_ICON = 0xF3D0, | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Description: Search for usages of the old Code::ERROR enum value that need updating.
# Search for explicit Code::ERROR or IconCode::ERROR references
rg -n --type=cpp --type=qml -e 'Code::ERROR\b' -e 'IconCode::ERROR\b' -g '!iconcodes.h'
# Also check for QML usages
rg -n -e 'IconCode\.ERROR\b' --type-add 'qml:*.qml' --type=qmlRepository: musescore/muse_framework Length of output: 182 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "=== iconcodes.h enum definitions around ERROR ==="
rg -n --type=cpp "enum class Code|ERROR_ICON|\\bERROR\\b" framework/ui/view/iconcodes.h
echo "--- snippet near ERROR_ICON ---"
python3 - <<'PY'
import re
path="framework/ui/view/iconcodes.h"
start=300; end=420
with open(path,'r',encoding='utf-8',errors='ignore') as f:
lines=f.readlines()
for i in range(start-1,end):
if 1<=i+1<=len(lines):
print(f"{i+1}: {lines[i].rstrip()}")
PY
echo
echo "=== Remaining usages of old names (excluding iconcodes.h) ==="
rg -n --type=cpp --type=qml -e 'Code::ERROR\b' -e 'IconCode::ERROR\b' -g '!iconcodes.h' .
rg -n -e 'IconCode\.ERROR\b' --type-add 'qml:*.qml' --type=qml .
echo
echo "=== Usages of new names (ERROR_ICON) ==="
rg -n --type=cpp --type=qml -e 'ERROR_ICON\b' -g '!iconcodes.h' .
rg -n -e 'IconCode\.ERROR_ICON\b' --type-add 'qml:*.qml' --type=qml . || true
echo
echo "=== Specific QML mapping location found earlier ==="
rg -n "case \"ERROR\"" -S framework/interactive/qml/Muse/Interactive/StandardDialogPanel.qml
sed -n '60,105p' framework/interactive/qml/Muse/Interactive/StandardDialogPanel.qmlRepository: musescore/muse_framework Length of output: 3236 🏁 Script executed: #!/bin/bash
set -u
echo "=== iconcodes.h: presence of ERROR_ICON ==="
rg -n --type=cpp "ERROR_ICON\\b" framework/ui/view/iconcodes.h
echo
echo "=== QML: remaining IconCode.ERROR references ==="
rg -n --type=qml "IconCode\\.ERROR\\b" . || true
echo
echo "=== QML: case \"ERROR\" mapping ==="
rg -n 'case[[:space:]]+"ERROR"' -S --type=qml framework/interactive/qml/Muse/Interactive/StandardDialogPanel.qml || true
sed -n '70,100p' framework/interactive/qml/Muse/Interactive/StandardDialogPanel.qml
echo
echo "=== Usages of ERROR_ICON ==="
rg -n --type=cpp --type=qml "\\bERROR_ICON\\b" . -g '!iconcodes.h' || true
rg -n --type=qml "IconCode\\.ERROR_ICON\\b" . || trueRepository: musescore/muse_framework Length of output: 1306 🏁 Script executed: #!/bin/bash
set -u
echo "=== iconcodes.h: occurrences of ERROR not followed by _ (to catch potential aliases) ==="
rg -n --type=cpp -S "ERROR(?!_)" framework/ui/view/iconcodes.h || true
echo
echo "=== iconcodes.h: lines mentioning ERROR_ICON specifically ==="
rg -n --type=cpp "ERROR_ICON" framework/ui/view/iconcodes.h
echo
echo "=== iconcodes.h: top-of-file preprocessor context around ERROR_ICON ==="
sed -n '1,120p' framework/ui/view/iconcodes.h
echo
echo "=== iconcodes.h: QML exposure (Q_ENUM / Q_NAMESPACE / etc) near the enum ==="
# show a wider window around the enum declaration and any QML macros
sed -n '40,120p' framework/ui/view/iconcodes.h
sed -n '320,380p' framework/ui/view/iconcodes.h
echo
echo "=== sanity: any 'ERROR' enum value entries in iconcodes.h (comma form) ==="
rg -n --type=cpp "ERROR\\s*=" framework/ui/view/iconcodes.h || true
rg -n --type=cpp "ERROR\\s*," framework/ui/view/iconcodes.h || trueRepository: musescore/muse_framework Length of output: 7021 Breaking API change: remaining 🤖 Prompt for AI Agents |
||
| QUESTION = 0xF3D1, | ||
|
|
||
| MUTE = 0xF3D5, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧹 Nitpick | 🔵 Trivial | 💤 Low value
The
ERROR_ICONguard is unnecessary.Unlike
ERROR,WARNING,INFO, andQUESTION, the nameERROR_ICONis not a macro defined by platform headers (e.g., Windows). This guard serves no protective purpose and can be safely removed. Alternatively, if downstream headers still requireERRORto be cleared, the original#undef ERRORshould be retained alongside the enum rename.🧹 Suggested removal
📝 Committable suggestion
🤖 Prompt for AI Agents