On Wed, 2018-05-23 at 17:38 -0500, Zebediah Figura wrote:
On 23/05/18 03:30, Hans Leidekker wrote:
On Tue, 2018-05-22 at 18:39 -0500, Zebediah Figura wrote:
Signed-off-by: Zebediah Figura z.figura12@gmail.com
dlls/msi/tests/action.c | 14 ++++++++++++ dlls/msi/tests/custom.c | 53 ++++++++++++++++++++++++++++++++++++++++++++++ dlls/msi/tests/custom.spec | 2 ++ 3 files changed, 69 insertions(+)
This produces warnings here (gcc 6.3.0):
custom.c: In function ‘pa_present’: custom.c:75:31: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation] #define todo_wine_if(is_todo) for (winetest_start_todo(is_todo); \ ^ custom.c:75:31: note: in definition of macro ‘todo_wine_if’ #define todo_wine_if(is_todo) for (winetest_start_todo(is_todo); \ ^~~ custom.c:1415:5: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the ‘for’ RegCloseKey(key); ^~~~~~~~~~~ custom.c: In function ‘pa_absent’: custom.c:75:31: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation] #define todo_wine_if(is_todo) for (winetest_start_todo(is_todo); \ ^ custom.c:75:31: note: in definition of macro ‘todo_wine_if’ #define todo_wine_if(is_todo) for (winetest_start_todo(is_todo); \ ^~~ custom.c:1431:9: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the ‘for’ RegCloseKey(key); ^~~~~~~~~~~
Adding braces as in the other functions gets rid of the warnings.
I guess I could add braces, but I'm not sure why it shouldn't work as-is. I just copied those macros from wine/test.h, and I don't understand why they would work normally but not here. Could someone please enlighten me?
This is what it looks like after preprocessing:
UINT __attribute__((__stdcall__)) __attribute__((__force_align_arg_pointer__)) pa_present(MSIHANDLE hinst) { ... for (winetest_start_todo(!MsiGetMode(hinst, MSIRUNMODE_SCHEDULED)); winetest_loop_todo(); winetest_end_todo()) check_reg_str(hinst, key, name_dotnet, "rcHQPHq?CA@Uv-XqMI1e>Z'q,T*76M@=YEg6My?~]"); RegCloseKey(key);
This indentation (supposedly) suggests that the RegCloseKey(key) call should be inside the 'for' body.
If I add braces:
UINT __attribute__((__stdcall__)) __attribute__((__force_align_arg_pointer__)) pa_present(MSIHANDLE hinst) { ... for (winetest_start_todo(!MsiGetMode(hinst, MSIRUNMODE_SCHEDULED)); winetest_loop_todo(); winetest_end_todo()) { check_reg_str(hinst, key, name_dotnet, "rcHQPHq?CA@Uv-XqMI1e>Z'q,T*76M@=YEg6My?~]"); } RegCloseKey(key);
or if I indent like this:
UINT __attribute__((__stdcall__)) __attribute__((__force_align_arg_pointer__)) pa_present(MSIHANDLE hinst) { ... for (winetest_start_todo(!MsiGetMode(hinst, MSIRUNMODE_SCHEDULED)); winetest_loop_todo(); winetest_end_todo()) check_reg_str(hinst, key, name_dotnet, "rcHQPHq?CA@Uv-XqMI1e>Z'q,T*76M@=YEg6My?~]"); RegCloseKey(key);}
the warning goes away. Does that answer your question?