Project

General

Profile

Bug #8400

CLang findings

Added by Tobias Ellinghaus over 7 years ago. Updated about 6 years ago.

Status:
In Progress
Priority:
High
Category:
General
Target version:
Start date:
Due date:
% Done:

50%

Affected Version:
git development version
System:
bitness:
64-bit
hardware architecture:
amd64/x86

Description

I just compiled dt with clang and got (besides tons of false positives) 7 warnings worth looking at:

.../src/libs/lib.c:219:13: warning: if statement has empty body [-Wempty-body]
    if(blob);
            ^

.../src/views/lighttable.c:166:3: warning: Declared variable-length array (VLA) has zero size
  int32_t imgids[count];
  ^              --~

.../src/libs/export.c:648:3: warning: Null pointer passed as an argument to a 'nonnull' parameter
  memcpy(params+pos, fdata, fsize); pos += fsize;
  ^                  --~

.../src/libs/export.c:649:3: warning: Null pointer passed as an argument to a 'nonnull' parameter
  memcpy(params+pos, sdata, ssize); pos += ssize;
  ^                  --~

.../src/iop/demosaic.c:128:69: warning: The left operand of '>' is a garbage value
          for (int i=0;i<8;i++) for(int ii=i+1;ii<9;ii++) if(med[i] > med[ii]) SWAP(med[i], med[ii]);
                                                             --- ^

.../src/imageio/storage/flickr.c:649:102: warning: Dereference of null pointer
    flickcurl_photosets_addPhoto (p->flickr_api->fc, p->flickr_api->current_album->id, photo_status->photoid);
                                                                                                     ^

.../imageio/storage/flickr.c:633:76: warning: Dereference of null pointer
    photoset_id = _flickr_api_create_photoset(p->flickr_api, photo_status->photoid);
                                                                           ^

History

#1 Updated by Tobias Ellinghaus over 7 years ago

Trac doesn't show long lines, so I attached the relevant parts, too.

#2 Updated by Tobias Ellinghaus over 7 years ago

I have just found some time to run the static code checker. After fixing the trivial stuff there are 56 issues left. Please have a look at the provided reports (open clang/2011-01-10-1/index.html in a browser) and fix whatever is in code you feel responsible for. However make sure that it's not a false positive (there are some, clang doesn't seem to like aliasing).

#3 Updated by Tobias Ellinghaus over 7 years ago

Hmm, the file was too big to attach here. Get it from http://www.stud.uni-saarland.de/~jeel5001/clang.tbz

#4 Updated by Tobias Ellinghaus over 7 years ago

Those three are false positives:

common/pwstorage/backend_gconf.c:47
common/pwstorage/backend_gconf.c:70
common/pwstorage/backend_gconf.c:90

#5 Updated by Tobias Ellinghaus over 7 years ago

For your convenience we now have http://darktable.sourceforge.net/clang/ which I will update from time to time.

#6 Updated by Simon Spannagel about 6 years ago

houz, what about these?
could you check and move/close ticket?

#7 Updated by Tobias Ellinghaus about 6 years ago

Since we moved our website to darktable.org I can no longer update the clang output, since darktable.sf.net/clang/ can't be reached any more. I need ftp/ssh access on darktable.org to make this work again. Or we have to fix the forward from sf.net to our new site to exclude that directory.

Regards closing, this ticket is supposed to stay open to remind us to check our code from time to time.

#8 Updated by Tobias Ellinghaus almost 6 years ago

  • Affected Version set to git development version

To have the reports available somewhere I put them on my webspace: http://houz.org/clang/

#9 Updated by Tobias Ellinghaus almost 6 years ago

  • % Done changed from 0 to 50
  • Status changed from New to In Progress

Also available in: Atom PDF