https://git.reactos.org/?p=reactos.git;a=commitdiff;h=b957229c1b82b66c5e9af14c8b3ad1a0aa7e3213

commit b957229c1b82b66c5e9af14c8b3ad1a0aa7e3213
Author:     Thomas Faber <[email protected]>
AuthorDate: Sat Aug 15 21:55:52 2020 +0200
Commit:     Thomas Faber <[email protected]>
CommitDate: Sun Aug 23 12:10:12 2020 +0200

    [XDK] Fix a noisy clang warning in RTL_CONSTANT_STRING. CORE-14306
    
    ..\ntoskrnl\vdm\vdmmain.c(91,34): warning: expression does not compute the 
number of elements in this array; element type is 'unsigned short', not 'char' 
[-Wsizeof-array-div]
        UNICODE_STRING PhysMemName = 
RTL_CONSTANT_STRING(L"\\Device\\PhysicalMemory");
                                     ^                   
~~~~~~~~~~~~~~~~~~~~~~~~~~~
    C:\ROS\reactos\output-clang\sdk\include\psdk\ntdef.h(1542,15): note: 
expanded from macro 'RTL_CONSTANT_STRING'
        sizeof(s) / sizeof(_RTL_CONSTANT_STRING_type_check(s)), \
               ~  ^
    ..\ntoskrnl\vdm\vdmmain.c(91,34): note: place parentheses around the 
'sizeof (_RTL_CONSTANT_STRING_type_check(L"\\Device\\PhysicalMemory"))' 
expression to silence this warning
    C:\ROS\reactos\output-clang\sdk\include\psdk\ntdef.h(1542,15): note: 
expanded from macro 'RTL_CONSTANT_STRING'
        sizeof(s) / sizeof(_RTL_CONSTANT_STRING_type_check(s)), \
                  ^
    1 warning generated.
---
 sdk/include/xdk/ntdef.template.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sdk/include/xdk/ntdef.template.h b/sdk/include/xdk/ntdef.template.h
index 80d497f2ddd..f6162348d60 100644
--- a/sdk/include/xdk/ntdef.template.h
+++ b/sdk/include/xdk/ntdef.template.h
@@ -220,7 +220,7 @@ char _RTL_CONSTANT_STRING_type_check(const void *s);
 #endif
 #define RTL_CONSTANT_STRING(s) { \
     sizeof(s)-sizeof((s)[0]), \
-    sizeof(s) / sizeof(_RTL_CONSTANT_STRING_type_check(s)), \
+    sizeof(s) / (sizeof(_RTL_CONSTANT_STRING_type_check(s))), \
     _RTL_CONSTANT_STRING_remove_const_macro(s) }
 
 #ifdef _MSC_VER

Reply via email to