SQLite Forum

Compiler warnings in shell.c on ArraySize(p->actualWidth)
Login

Compiler warnings in shell.c on ArraySize(p->actualWidth)

(1) By anonymous on 2020-05-29 16:35:57 [source]

Compiling 445ed5dab2c2 with clang, getting apparently legit warnings, effectively due to sizeof(arrptr), with arrptr being dynamically alloc'ed array kind. Thus sizeof() is equivalent to sizeof(void*), which is probably not what's intended.

Here's one of the affected lines shell.c.in:2057

shell.c:10616:11: warning: 'sizeof (p->actualWidth)' will return the size of the
      pointer, not the array itself [-Wsizeof-pointer-div]
    if( i<ArraySize(p->actualWidth) ){
          ^~~~~~~~~~~~~~~~~~~~~~~~~
shell.c:402:38: note: expanded from macro 'ArraySize'
#define ArraySize(X)  (int)(sizeof(X)/sizeof(X[0]))
                            ~~~~~~~~~^
shell.c:10713:17: warning: 'sizeof (p->actualWidth)' will return the size of the
      pointer, not the array itself [-Wsizeof-pointer-div]
          if( i<ArraySize(p->actualWidth) ){
                ^~~~~~~~~~~~~~~~~~~~~~~~~
shell.c:10724:19: warning: 'sizeof (p->actualWidth)' will return the size of the
      pointer, not the array itself [-Wsizeof-pointer-div]
            if( i<ArraySize(p->actualWidth) ){
                  ^~~~~~~~~~~~~~~~~~~~~~~~~
shell.c:10735:19: warning: 'sizeof (p->actualWidth)' will return the size of the
      pointer, not the array itself [-Wsizeof-pointer-div]
            if( i<ArraySize(p->actualWidth) ){
                  ^~~~~~~~~~~~~~~~~~~~~~~~~
shell.c:10760:15: warning: 'sizeof (p->actualWidth)' will return the size of the
      pointer, not the array itself [-Wsizeof-pointer-div]
        if( i<ArraySize(p->actualWidth) ){
              ^~~~~~~~~~~~~~~~~~~~~~~~~

(2) By Richard Hipp (drh) on 2020-05-29 16:54:34 in reply to 1 [link] [source]

I think this is already fixed in the subsequent check-in.