Beep6581 / RawTherapee

A powerful cross-platform raw photo processing program
https://rawtherapee.com
GNU General Public License v3.0
2.89k stars 323 forks source link

Compiling with -Wall shows a large amount of warnings which should be fixed #3790

Closed heckflosse closed 7 years ago

heckflosse commented 7 years ago

I want to try to make rt a bit more -Wall-clean. I will start with compilation units in rtengine Checked means it's clean. Unchecked means it's not clean or not tested yet.

Floessie commented 7 years ago

@heckflosse I don't see a branch, yet. I could join you from time to time.

heckflosse commented 7 years ago

@Floessie I will create a branch now after committing fixes for the compilation units at top of the list. Maybe we should agree about the procedure to avoid double work. Kind of I start from top and you start from bottom until we meet (or vice versa)

heckflosse commented 7 years ago

@Floessie I created the new branch wallfix ;-)

Floessie commented 7 years ago

Kind of I start from top and you start from bottom until we meet

:+1:

Desmis commented 7 years ago

Can I help, even Ingo start from top, and Floessie start from bottom :)

Floessie commented 7 years ago

@Desmis Maybe you could pick the ones you like to work on now from the end of the list and put your name on it. Then I'll do the same later for the ones that I'm going to clean.

Desmis commented 7 years ago

@Floessie Ok, but how to do, I am a not at all a specialist for compilation : a) for compilation directives with windows , which files in cmake ? b) for only have warning for one specific file c) etc. Thank you Jacques

heckflosse commented 7 years ago

@Desmis For temporary usage of compiler switches I always cheat by modifying CMakeCache.txt in build folder. HowTo:

  1. Open CMakeCache.txt
  2. Search for PROC_TARGET_2_FLAGS:STRING=-march=native
  3. Add - Wall to that line and save
  4. make, but ignore all the warnings because it makes a full build now
  5. open a source file from the list above (for example ipwavelet.cc) and add space in first line, delete that space and save
  6. make, now you get only the warnings related to that file and the included files.
Desmis commented 7 years ago

Ingo

OK, thank you, I'll try soon :)

Desmis commented 7 years ago

Ok, thats works :) I just change ipvibrance.cc in the middle of the list jacques

heckflosse commented 7 years ago

@Desmis Jacques, please do not reformat the code during this cleanup. It makes it impossible to see what you fixed.

Desmis commented 7 years ago

Ok :)

Floessie commented 7 years ago

BTW: What's the matter of adding spaces between function name and the opening parenthesis? Haven't seen it very often, but there must be some reasoning to it.

PS: I'll join you on the weekend.

heckflosse commented 7 years ago

@Desmis Jacques, I will take improcfun.cc now :)

Desmis commented 7 years ago

@heckflosse How do we do, for commit and push... I am afraid of probable conflicts, but maybe there are no risks ?

heckflosse commented 7 years ago

@Desmis One solution could be to use wallfix_desmis, wallfix_flossie and wallfix_ingo branches

Edit: Btw. I just pushed

heckflosse commented 7 years ago

@Floessie @Desmis I will work now on wallfix_ingo branch to avoid conflicts. I always make one commit per compilation unit

heckflosse commented 7 years ago

@Floessie @Desmis Scratch my lost post. I have to think about that first

Beep6581 commented 7 years ago

I don't know how messy this will get, but if you are able to confine the changes to individual files then working in the same branch and committing/pulling every time you're done with a single file would be easy and it would make this easier for others to checkout and test.

Desmis commented 7 years ago

I create wall_jacq and push changes for FTblockdn.cc Edgeprervingdecomposition.cc previewimage.cc with changes and Pfcorrect.cc iimage.cc jdatsrc.cc imagedimensions.cc icons.cc utils.cc - no nead changes

Now I make a pause,To be sure we work well together :)

heckflosse commented 7 years ago

@Desmis I will take rawimagesource.cc, demosaic_algos.cc and fast_demo.cc now @Beep6581 I made a commit for each single compilation unit and from now on I will also make a push for each commit

Floessie commented 7 years ago

@heckflosse I marked my initial three and will push to your branch.

heckflosse commented 7 years ago

@Floessie Oups, saw this too late. I hope my commit from now will not conflict.

Floessie commented 7 years ago

@heckflosse Sure it will, but I'll revert mine. :smile:

heckflosse commented 7 years ago

@Floessie @Desmis I will take improccoordinator.cc, simpleprocess.cc and dcrop.cc now

Floessie commented 7 years ago

@heckflosse How comes, there are files you listed that don't trigger here?

heckflosse commented 7 years ago

@Floessie You mean in my commits? In first post I just listed all compilation units of rtengine

Floessie commented 7 years ago

@heckflosse No, I mean, I compile them with -Wall, but don't get a warning...

Floessie commented 7 years ago

@heckflosse

In first post I just listed all compilation units of rtengine

Ah, that is why.

Floessie commented 7 years ago

@heckflosse Sorry, no time left tonight. I was working on rtthumbnail.cc: If we have a height or width, or a file size, shall we turn that into an unsigned or just cast the place with the comparison to signed?

heckflosse commented 7 years ago

@Floessie @Desmis It's really great to see the progress of this task. I expected that to take much longer. Now I think we can at least make rtengine compilation units -Wall-clean very soon (except dcraw.cc maybe...)

heckflosse commented 7 years ago

@Floessie I use unsigned when there is no subtraction. When there is a subtraction I use signed because I'm too lazy to search for possible side effects.

heckflosse commented 7 years ago

@Floessie Can I push some changes or do you have something on hold?

heckflosse commented 7 years ago

@Floessie I pushed my changes @Desmis I also merged your changes into wallfix branch

agriggio commented 7 years ago

sorry to jump in this late, but if you need help let me know! also, if you care usually clang is much more pedantic than GCC with -Wall

heckflosse commented 7 years ago

@agriggio the rtengine part is almost done now (at least for -Wall). But helping out for rtgui compilation units and also checking using more pedantic clang would be great :+1:

heckflosse commented 7 years ago

I also just started a cppcheck run...

agriggio commented 7 years ago

OK, I'll see what I can do

heckflosse commented 7 years ago

@agriggio Great :+1:

heckflosse commented 7 years ago

@Floessie @Desmis @agriggio @Beep6581 Shall I open a new checklist for rtgui or add it to this issue?

Desmis commented 7 years ago

@heckflosse Ingo I prefer a new checklist :)

Desmis commented 7 years ago

@heckflosse I have begun rtgui

No problem with : wavelet.cc, vibrance.cc One small change to whitebalance.cc

Desmis commented 7 years ago

One change to colortoning.cc

No problem with retinex.cc blackwhite.cc colorappearance.cc

Desmis commented 7 years ago

No problem with : dirpyrdenoise.cc dirpyrequalizer.cc labcurve.cc rawexposure.cc tonecurve.cc sharpening.cc sharpenedge.cc rawcacorrection.cc prsharpening.cc icmpanel.cc

heckflosse commented 7 years ago

Here's the checklist for rtgui:

agriggio commented 7 years ago

Can I give a shot to the files in rtengine? Clang still gives me some meaningful warnings (I silenced the less useful ones). Also, what about rtexif? And why is rgengine/fujicompressed.cc not listed?

heckflosse commented 7 years ago

@agriggio Sure you can give it a shot :+1: rtengine/fujicompressed.cc is not listed because currently it's not an own compilation unit. But I agree that we should fix warnings in this one too! rtexif also needs to be checked but I wanted to have an own checklist for it too when rtgui is completed

agriggio commented 7 years ago

rtexif is almost clean already, there's only one warning - I can fix that.

agriggio commented 7 years ago

I'm also working on rtgui -- I'm basically done. I'm leaving the deprecation warnings about gdk_threads* in main.cc

agriggio commented 7 years ago

it seems I was wrong about rtexif. Clang gives no warning now, but gcc shows many places in which the return values of fread, read, fwrite and write are ignored. How should we fix those though? The easy solution is to cast explicitly to void, should we do that or should we try to handle the possible failures?