FLTK logo

STR #2813

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 Home  |  Articles & FAQs  |  Bugs & Features  |  Documentation  |  Download  |  Screenshots  ]
 

Return to Bugs & Features | Roadmap 1.3 | SVN ⇄ GIT ]

STR #2813

Application:FLTK Library
Status:1 - Closed w/Resolution
Priority:1 - Request for Enhancement, e.g. asking for a feature
Scope:2 - Specific to an operating system
Subsystem:WIN32
Summary:Tons of compile warnings in mingw64
Version:1.3-feature
Created By:csaba
Assigned To:AlbrechtS
Fix Version:1.3.4 (SVN: v10711)
Update Notification:

Receive EMails Don't Receive EMails

Trouble Report Files:


Name/Time/Date Filename/Size  
 
#1 csaba
09:19 Mar 22, 2012
fltk-1.3.x-r9285.mingw64.warnings
211k
 
 
#2 csaba
09:19 Mar 22, 2012
fltk-1.3.x-r9285.mingw64.patch
12k
 
 
#3 csaba
11:19 Mar 22, 2012
vclog.txt
1k
 
 
#4 csaba
18:21 Sep 04, 2014
fltk-1.3.x-r10271.patch
14k
 
 
#5 AlbrechtS
04:23 Apr 03, 2015
csaba_r10665.patch
10k
 
 
#6 AlbrechtS
06:18 Apr 03, 2015
fluid.patch
1k
 
 
#7 AlbrechtS
06:19 Apr 03, 2015
Fl_Value_Slider.patch
2k
 
 
#8 AlbrechtS
06:19 Apr 03, 2015
gleam.patch
1k
 
 
#9 AlbrechtS
06:20 Apr 03, 2015
callback.patch
3k
 
 
#10 csaba
16:15 Apr 07, 2015
fltk-1.3.x-warning-fixes.diff
3k
 
 
#11 csaba
16:33 Apr 07, 2015
test.fl
0k
 
     

Trouble Report Comments:


Name/Time/Date Text  
 
#1 csaba
09:19 Mar 22, 2012
Compiling any recent fltk-1.3.x-r.XXXX with MINGW64 using their latest 4.7.0 G++ version will result in a ton of compile warnings. Most of these are due to sizeof(long) < sizeof(void *) in this architecture, but there are a few more that are the result of some stricter checks performed in the new compiler.

Attached files contain the warnings and the patches to fix them.
 
 
#2 ianmacarthur
10:24 Mar 22, 2012
Yup - this is going to be a problem with all the new compilers, they are all getting a lot more picky in their old age...

I guess using an intptr_t style value is the way to go, I see from your patch that you have opted for an "fl_intptr_t" which I guess makes sense, we can define that as required for host systems that may not have intptr_t natively.

I can't see where you are declaring fl_intptr_t though... is there stuff missing from the patch, or am I just blind?
 
 
#3 csaba
10:47 Mar 22, 2012
Ian, Thanks for the reply. Yup, the definition of 'fl_intptr_h' is a mystery. There are already cases of it being used (in non #ifdef-d contexts!) throughout the code before my patch:

csaba-workpc:fltk-1.3.x-r9285-orig$ grep fl_intptr_t */*.[chH]*
FL/Fl_Menu_Item.H:  long argument() const {return (long)(fl_intptr_t)user_data_;}
FL/Fl_Widget.H:  \todo typedef's fl_intptr_t and fl_uintptr_t should be documented.
FL/Fl_Widget.H:typedef intptr_t fl_intptr_t;
FL/Fl_Widget.H:typedef long fl_intptr_t;
FL/Fl_Widget.H:  long argument() const {return (long)(fl_intptr_t)user_data_;}
fluid/Fl_Widget_Type.cxx:  int n = fl_intptr_t(i->user_data());
fluid/fluid.cxx:    _fpt = _fdopen(_open_osfhandle((fl_intptr_t) h,_O_BINARY),mode);
src/fl_ask.cxx:  ret_val = (fl_intptr_t)val;
test/arc.cxx:  args[fl_intptr_t(v)] = s->value();
test/cursor.cxx:  cursor = (Fl_Cursor)(fl_intptr_t)v;
test/curve.cxx:  args[fl_intptr_t(v)] = s->value();
test/fractals.cxx:void setlevel(Fl_Widget*, void *value) {setlevel(fl_intptr_t(value));}
test/fractals.cxx:void choosefract(Fl_Widget*, void *value) {choosefract(fl_intptr_t(value));}
test/fractals.cxx:void handlemenu(Fl_Widget*, void *value) {handlemenu(fl_intptr_t(value));}
test/input.cxx:  switch ((fl_intptr_t)v) {
test/scroll.cxx:  thescroll->type((uchar)((fl_intptr_t)v));
test/scroll.cxx:  thescroll->scrollbar.align((uchar)((fl_intptr_t)v));
test/table.cxx:    G_table->table_box((Fl_Boxtype)(fl_intptr_t)data);
test/table.cxx:    G_table->box((Fl_Boxtype)(fl_intptr_t)data);
test/table.cxx:    G_table->type((Fl_Table_Row::TableRowSelectMode)(fl_intptr_t)data);
test/tree.cxx:          (long)(fl_intptr_t)tree->user_data(),

I was looking for its declaration for non _WIN64 targets and could not find it either, but still got no compile errors. Weird. After the mingw64 build I actually configure-d my patched version for a native build (Linux x86_64), no errors or warnings. Go figure...
 
 
#4 csaba
10:53 Mar 22, 2012
Discard previous post. Actually, FL/Fl_Widget.H declares it for all targets.  
 
#5 greg.ercolano
10:58 Mar 22, 2012
> sizeof(long) < sizeof(void *) in this architecture

    Just curious: on what architecture is this true?
    (In case we need to test)
 
 
#6 csaba
11:19 Mar 22, 2012
The WIN64 ABI was defined this way by Micro$haft. See attached file. This is the only one I am aware of.  
 
#7 ianmacarthur
15:38 Sep 04, 2014
Do we know whether, in the intervening years, many of these cast fixes have been applied?

I'm asking because, recently, I was doing some stuff with mingw64 and got a *lot* of these warnings still... do we want to hunt these down and cast them away?

Or...?
 
 
#8 csaba
18:28 Sep 04, 2014
Hello Ian,

Long time no hear. I do not think any of them have been applied. Attached is a patch against the latest SVN that fixes all compile warnings in mingw.

This is based on my working copy of FLTK, with ALL my local changes, just updated to the latest SVN. Most of the diffs are for compile warnings, but there are a few you may not want. I did not go to the trouble of separating them out, considering that anything I submit does not get used anyway. The extra 'stuff' in the patch that you may or may not want:

* Make the text box area of Fl_Value_Slider user settable. Breaks the ABI, but IMHO a change that is very much needed to make this widget more usable. Have you ever seen a value slider display a 6..8 digit number properly?
* A simple code generator change in fluid that avoids the 'variable w is unused' warning in some cases.
* Some leftover Fl_Gleam changes. Probably not needed now, leftovers from when I merged in the gleam theme before it was officially adopted.

Also note that for me an unchanged SVN checkout will fail to compile due to wrong Xutf8 dependencies introduced by card's recent changes. A simple 'make depend' in the 'src' directory fixes that.

Csaba
 
 
#9 ianmacarthur
03:55 Sep 05, 2014
See also;

#2878  #2813 #3038
 
 
#10 AlbrechtS
04:23 Apr 03, 2015
Hi Csaba, thanks for your patch(es) and sorry for the long delay. I fixed some parts in single commits (svn log -r10661:10664):

r10661 | Add missing cast (part of patch for STR #2813).
r10662 | Fix uninitialized variable compiler warning (part of STR #2813).
r10663 | Fix compiler warning (another part of STR #2813).
r10664 | Fix compiler warning on Windows 64-bit (STR #2813).

I attach the updated full patch as of svn r10665 in file csaba_r10665.patch. The patch should apply cleanly with `patch -p1' to current svn.

I intend to isolate unrelated parts of the patch in one or more steps and post separate patches.
 
 
#11 AlbrechtS
06:18 Apr 03, 2015
More fixes in subversion:

r10666 | Fix compiler warnings in test/forms.cxx and more (inspired by STR #2813).
r10667 | Fix more compiler warnings in test/*.cxx (STR #2813).

I'll upload the remaining patches as separate files:

fluid.patch: not yet checked.

Fl_Value_Slider.patch: needs ABI changes. May be applied though with appropriate ABI guards.

gleam.patch: changes box_dx(), box_d() values etc.. Needs verification.

callback.patch: This is the final patch related to casts in the environment of callbacks. No other changes are included. We discussed this in fltk.coredev recently. This patch might be a working solution for the callback casting issues.
 
 
#12 AlbrechtS
06:34 Apr 03, 2015
Summary:

All patches before fluid.patch (i.e. files #2, #4, and #5) are now obsolete (as of svn r 10667).

Patch files #6, #7, #8, and #9 should be independent of each other.

Patch files #6, #7, and #8 are not related to the callback casting issue AFAICT (fluid.patch fixes other compiler warnings).


@Manolo: I won't touch #9 (callback.patch) any more now. I wanted to isolate the callback-related parts of Csaba's patch to be able to compare with whatever solution we may find for the callback, argument(), and user_data_ (casting) issues.
 
 
#13 manolo
01:00 Apr 04, 2015
Yes, callback.patch seems a perfect solution to remove all
compilation warnings on 64-bit MSWindows.
Please, do commit it.
 
 
#14 AlbrechtS
06:01 Apr 04, 2015
Fixed in Subversion repository.

Done. The main part is now ready. I don't see any warnings in 64-bit compilation under Windows.

Complete summary of fixes:

r10661 | Add missing cast (part of patch for STR #2813).
r10662 | Fix uninitialized variable compiler warning (part of STR #2813).
r10663 | Fix compiler warning (another part of STR #2813).
r10664 | Fix compiler warning on Windows 64-bit (STR #2813).
r10666 | Fix compiler warnings in test/forms.cxx and more (inspired by STR #2813).
r10667 | Fix more compiler warnings in test/*.cxx (STR #2813).
r10670 | Fix Windows 64-bit compilation warnings (STR #2813).

Csaba, please confirm if this fixes the warnings for you as well.

Leaving the STR open for feedback and because of open patches.
 
 
#15 AlbrechtS
06:04 Apr 04, 2015
There are still three open patches that should be checked:

#6: fluid.patch: might fix warnings in generated code. See below.

#7: Fl_Value_Slider.patch: needs ABI changes. May be applied though with appropriate ABI guards. Unrelated (no compiler warnings).

#8: gleam.patch: changes box_dx(), box_dy() etc.. Needs verification. Unrelated as well.


Csaba, I understand what hunk #1 in fluid.patch does, that's okay. Can you tell us what hunk #2 in fluid.patch is good for? Does it fix a "variable ... set but not used" warning in generated code? I don't see anything related to this patch in your posted file #1 <http://www.fltk.org/strfiles/2813/fltk-1.3.x-r9285.mingw64.warnings>. Do you have an example .fl file so we can test?

Regarding gleam.patch: is it true that its intention is to fix the box border sizes (box_dx() etc.)? If yes, how did you find out? Do you have a test file, or do I need to check the code? Anything else about it?
 
 
#16 csaba
16:14 Apr 07, 2015
Albrecht,

I updated my working copy to your latest SVN. Everything merged cleanly, most of my diffs versus the "official" are gone. There are a few leftovers in the "fix compile warnings" category. I am uploading these in a follow-up post. The diffs do two things:
(1) They fix some warnings by casting {label,box}type enum constants to integer types in struct initializers.
(2) Fluid generated code can contain an unused 'w' pointer variable for the top level group or window. I am adding a no-op assignment to avoid compiler warnings.

Csaba
 
 
#17 csaba
16:21 Apr 07, 2015
Relative to the patch I just posted, my only remaining differences (against the "official" SVN version) are the 'Fl_Value_Slider' changes. I know that these break the ABI, so may not make it in there...  
 
#18 csaba
16:34 Apr 07, 2015
Also posted an FL file that shows how 'w' can be unused.  
 
#19 AlbrechtS
12:43 Apr 10, 2015
Thanks for the fluid file. I committed svn r 10696 which should fix the fluid issue. Note that it's a very different patch.

r10696 | Fix compiler warnings in fluid-generated code (STR #2813).


I believe that the other part of your patch (test/forms.cxx) is not necessary anymore. The struct member variable is now Fl_Boxtype, so your patch is not useful anymore. Please verify that it is not needed. If you still get warnings, please post your compiler options and the error messages.

The only remaining part is now file #8: gleam.patch. Can you tell what exactly this is intended to do or why it is needed? TIA.
 
 
#20 AlbrechtS
05:27 Apr 21, 2015
Fixed in Subversion repository.

The gleam patch turned out to have several wrong values, but current svn had some wrong values as well. Fixed in svn r10711.

I opened another STR for the Fl_Value_Slider issue with patch:
http://www.fltk.org/str.php?L3222
http://www.fltk.org/strfiles/3222/Fl_Value_Slider.patch


Complete summary of fixes of this STR:

r10661 | Add missing cast (part of patch for STR #2813).
r10662 | Fix uninitialized variable compiler warning (part of STR #2813).
r10663 | Fix compiler warning (another part of STR #2813).
r10664 | Fix compiler warning on Windows 64-bit (STR #2813).
r10666 | Fix compiler warnings in test/forms.cxx and more (inspired by STR #2813).
r10667 | Fix more compiler warnings in test/*.cxx (STR #2813).
r10670 | Fix Windows 64-bit compilation warnings (STR #2813).
r10696 | Fix compiler warnings in fluid-generated code (STR #2813).
r10711 | Fix box sizes (box_dx() etc.) of scheme gleam.

Thanks. Closed.
 
     

Return to Bugs & Features ]

 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.