Skip to content
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

Configs - Cleanup for hemtt macro padding check #1624

Merged
merged 3 commits into from
Nov 2, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions addons/common/Cfg3DEN.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ class Cfg3DEN {
for '_y' from 1900 to 2050 do {\
_ctrlYear lbSetValue [ARR_2(_ctrlYear lbAdd str _y,_y)];\
};\
_ctrlYear lbSetCurSel 53;\
);
_ctrlYear lbSetCurSel 53;);
};
};
};
Expand All @@ -32,8 +31,7 @@ class Cfg3DEN {
_this setGroupID [ARR_1(_value)];\
} else {\
[ARR_2(_this,_value)] call CBA_fnc_setCallsign;\
};\
);
};);
};
};
};
Expand Down
4 changes: 2 additions & 2 deletions addons/diagnostic/gui.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ class RscTitles {
idc = -1;
font = "RobotoCondensedBold";
sizeEx = QUOTE(0.55 * GUI_GRID_CENTER_H);
x = QUOTE( 0 * GUI_GRID_CENTER_W + GUI_GRID_CENTER_X);
y = QUOTE( 5 * GUI_GRID_CENTER_H + GUI_GRID_CENTER_Y);
x = QUOTE(0 * GUI_GRID_CENTER_W + GUI_GRID_CENTER_X);
y = QUOTE(5 * GUI_GRID_CENTER_H + GUI_GRID_CENTER_Y);
w = QUOTE(40 * GUI_GRID_CENTER_W);
h = QUOTE(10 * GUI_GRID_CENTER_H);
colorBackground[] = {1,0.2,0,0.8};
Expand Down
2 changes: 1 addition & 1 deletion addons/optics/RscInGameUI.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class RscInGameUI {
};

class CBA_ScriptedOptic: RscWeaponZeroing {
onLoad = QUOTE([ARR_2(_this select 0, true)] call FUNC(loadScriptedOptic));
onLoad = QUOTE([ARR_2(_this select 0,true)] call FUNC(loadScriptedOptic));
controls[] = {"CA_FOVMode","ScopeBlack","Reticle","BodyNight","BodyDay","TrippleHeadLeft","TrippleHeadRight","CA_Zeroing","Magnification","ActiveDisplayHelper"};

// Idea by Taosenai. This control can be used to determine whether the scope or the collimator is used.
Expand Down
3 changes: 1 addition & 2 deletions addons/settings/gui.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -653,8 +653,7 @@ class RscDisplayEmpty;
class GVAR(MainMenuHelper): RscDisplayEmpty {
onLoad = QUOTE(\
(_this select 0) call FUNC(openSettingsMenu);\
(_this select 0) closeDisplay 0;\
);
(_this select 0) closeDisplay 0;);
};

class GVAR(export) {
Expand Down
18 changes: 9 additions & 9 deletions addons/ui/RscTitles.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
class RscTitles {
class GVAR(ProgressBar) {
onLoad = QUOTE(with uiNameSpace do { GVAR(ProgressBar) = _this select 0 }; );
onLoad = QUOTE(with uiNameSpace do { GVAR(ProgressBar) = _this select 0 };);
idd = -1;
duration = 1e+11;
fadeIn = 0;
Expand All @@ -21,10 +21,10 @@ class RscTitles {
style = ST_CENTER;
sizeEx = QUOTE(1 * GUI_GRID_CENTER_H);
colorBackground[] = {0,0,0,0.5};
x = QUOTE(profileNamespace getVariable [ARR_2(QUOTE(QUOTE(TRIPLES(IGUI,GVAR(grid),X))), 0)]);
y = QUOTE(profileNamespace getVariable [ARR_2(QUOTE(QUOTE(TRIPLES(IGUI,GVAR(grid),Y))), 0)]);
w = QUOTE(profileNamespace getVariable [ARR_2(QUOTE(QUOTE(TRIPLES(IGUI,GVAR(grid),W))), 0)]);
h = QUOTE(profileNamespace getVariable [ARR_2(QUOTE(QUOTE(TRIPLES(IGUI,GVAR(grid),H))), 0)]);
x = QUOTE(profileNamespace getVariable [ARR_2(QUOTE(QUOTE(TRIPLES(IGUI,GVAR(grid),X))),0)]);
y = QUOTE(profileNamespace getVariable [ARR_2(QUOTE(QUOTE(TRIPLES(IGUI,GVAR(grid),Y))),0)]);
w = QUOTE(profileNamespace getVariable [ARR_2(QUOTE(QUOTE(TRIPLES(IGUI,GVAR(grid),W))),0)]);
h = QUOTE(profileNamespace getVariable [ARR_2(QUOTE(QUOTE(TRIPLES(IGUI,GVAR(grid),H))),0)]);
};

class TitleText: TitleBackground {
Expand All @@ -38,10 +38,10 @@ class RscTitles {
colorFrame[] = {0,0,0,0.5};
colorBar[] = GUI_BCG_COLOR;
texture = "#(argb,8,8,3)color(1,1,1,0.7)";
x = QUOTE(profileNamespace getVariable [ARR_2(QUOTE(QUOTE(TRIPLES(IGUI,GVAR(grid),X))), 0)]);
y = QUOTE(profileNamespace getVariable [ARR_2(QUOTE(QUOTE(TRIPLES(IGUI,GVAR(grid),Y))), 0)]);
w = QUOTE(profileNamespace getVariable [ARR_2(QUOTE(QUOTE(TRIPLES(IGUI,GVAR(grid),W))), 0)]);
h = QUOTE(profileNamespace getVariable [ARR_2(QUOTE(QUOTE(TRIPLES(IGUI,GVAR(grid),H))), 0)]);
x = QUOTE(profileNamespace getVariable [ARR_2(QUOTE(QUOTE(TRIPLES(IGUI,GVAR(grid),X))),0)]);
y = QUOTE(profileNamespace getVariable [ARR_2(QUOTE(QUOTE(TRIPLES(IGUI,GVAR(grid),Y))),0)]);
w = QUOTE(profileNamespace getVariable [ARR_2(QUOTE(QUOTE(TRIPLES(IGUI,GVAR(grid),W))),0)]);
h = QUOTE(profileNamespace getVariable [ARR_2(QUOTE(QUOTE(TRIPLES(IGUI,GVAR(grid),H))),0)]);
};

class Script: RscMapControl {
Expand Down
1 change: 1 addition & 0 deletions addons/ui/flexiMenu/data/menu_arma2.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//#include "..\..\script_component.hpp"
#pragma hemtt suppress pw3_padded_arg file

#define _DefaultAspectRatio 3 / 4
#define _SX (safeZoneX+safeZoneW / 2) // screen centre x
Expand Down
1 change: 1 addition & 0 deletions addons/ui/flexiMenu/data/menu_buttonList.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//#include "..\..\script_component.hpp"
#pragma hemtt suppress pw3_padded_arg file

#define _imagePath(TOKEN) QUOTE(PATHTOF(flexiMenu)\data\buttonList\TOKEN.paa)
#define _SX (safeZoneX + safeZoneW / 2) // screen centre x
Expand Down
1 change: 1 addition & 0 deletions addons/ui/flexiMenu/data/menu_iconRow.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//#include "..\..\script_component.hpp"
#pragma hemtt suppress pw3_padded_arg file

#define _imagePath(TOKEN) QUOTE(PATHTOF(flexiMenu)\data\arma2\TOKEN.paa)
#define _SX (safeZoneX + safeZoneW / 2) // screen centre x
Expand Down
1 change: 1 addition & 0 deletions addons/ui/flexiMenu/data/menu_popup.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// #include "..\..\script_component.hpp"
#pragma hemtt suppress pw3_padded_arg file

#define _imagePath(TOKEN) QUOTE(PATHTOF(flexiMenu)\data\popup\TOKEN.paa)
#define _SX (safeZoneX + safeZoneW / 2) //screen centre x
Expand Down
1 change: 1 addition & 0 deletions addons/ui/flexiMenu/data/menu_rose.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//#define DEBUG_MODE_FULL
//#include "..\..\script_component.hpp"
#pragma hemtt suppress pw3_padded_arg file

#define _DefaultAspectRatio 3 / 4
#define _SX (safeZoneX + safeZoneW / 2) //screen centre x
Expand Down
3 changes: 3 additions & 0 deletions include/a3/ui_f/hpp/defineDIKCodes.inc
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#pragma hemtt suppress pw3_padded_arg file
#pragma hemtt suppress pw3_padded_arg config

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@BrettMayson - still getting with either/both line, not sure if error or just how the includes work

[PW3] Warning: padding a macro argument
     ╭─[/a3/ui_f/hpp/defineDIKCodes.inc:119:36]
     │
 119 │ #define DIK_NUMPADENTER     0x9C    /* Enter on numeric keypad */
     │                                    ┬
     │                                    ╰── padding a macro argument is likely unintended

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's might be where DIK_NUMPADENTER is being used, and the error is just pointing to the wrong location. The comment will be removed, but the padded whitespace won't

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, it's on use not on define
which is actually good because it means we don't have to touch the bi files
a nice-to-have would be to indicate usage location

#ifndef DIK_ESCAPE

/****************************************************************************
Expand Down
20 changes: 20 additions & 0 deletions tools/make.py
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,21 @@ def cleanup_optionals(mod):
print_error("Cleaning Optionals Failed")
raise

# mikro tools (before 2023?) don't understand #pragma
def toggle_config_pragmas(do_restore=False):
token_from = "//#pragma-backup-make.py " if do_restore else "#pragma "
token_to = "#pragma " if do_restore else "//#pragma-backup-make.py "
print_green(f"Checking configs for {token_from}")
for root, _dirs, files in os.walk(module_root):
for file in files:
if file.endswith(".cpp") or file.endswith(".hpp"):
with open(os.path.join(root, file), "r", encoding="utf-8") as f:
content = f.read()
if (not token_from in content): continue
print(f"- Replacing {token_from} in {os.path.join(root, file)}")
content = re.sub(token_from, token_to, content)
with open(os.path.join(root, file), "w", encoding="utf-8") as f:
f.write(content)

def purge(dir, pattern, friendlyPattern="files"):
print_green("Deleting {} files from directory: {}".format(friendlyPattern,dir))
Expand Down Expand Up @@ -1105,6 +1120,9 @@ def main(argv):
optional_files = []
copy_optionals_for_building(optionals_modules,optional_files)

# hide #pragma from pboProject's sensitive eyes
toggle_config_pragmas(False)

# Get list of subdirs in make root.
dirs = next(os.walk(module_root))[1]

Expand Down Expand Up @@ -1446,6 +1464,8 @@ def main(argv):
copy_important_files(module_root_parent,os.path.join(release_dir, project))
if (os.path.isdir(optionals_root)):
cleanup_optionals(optionals_modules)
#restore #pragma
toggle_config_pragmas(True)
if not version_update:
restore_version_files()

Expand Down
Loading