FLTK logo

[master] 08a8e78 - Fix compiler warning

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 
 All Forums  |  Back to fltk.commit  ]
 
Previous Message ]Next Message ]

[master] 08a8e78 - Fix compiler warning "Albrecht Schlosser" May 03, 2021  
 
commit 08a8e78d6e8398739e610a424ed3644f41075e05
Author:     Albrecht Schlosser <albrechts.fltk@online.de>
AuthorDate: Mon May 3 21:22:40 2021 +0200
Commit:     Albrecht Schlosser <albrechts.fltk@online.de>
CommitDate: Mon May 3 21:23:29 2021 +0200

    Fix compiler warning
    
    Apple clang version 12.0.5 (clang-1205.0.22.9)
    Target: arm64-apple-darwin20.4.0
    
    Warning appeared after upgrade to Xcode 12.5 in several files,
    example:
    
    In file included from Fl_Scroll.cxx:19:
    ../FL/Fl_Scroll.H:102:17: warning: anonymous non-C-compatible type given name for linkage purposes by typedef declaration; add a tag name here [-Wnon-c-typedef-for-linkage]
      typedef struct {
                    ^
                     ScrollInfo
    ../FL/Fl_Scroll.H:104:5: note: type is not C-compatible due to this member declaration
        typedef struct { int x,y,w,h; } Fl_Region_XYWH;
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ../FL/Fl_Scroll.H:128:5: note: type is given name 'ScrollInfo' for linkage purposes by this typedef declaration
      } ScrollInfo;
        ^

 FL/Fl_Scroll.H | 40 ++++++++++++++++++++++------------------
 1 file changed, 22 insertions(+), 18 deletions(-)

diff --git FL/Fl_Scroll.H FL/Fl_Scroll.H
index bc51fe1..ed0f6ac 100644
--- FL/Fl_Scroll.H
+++ FL/Fl_Scroll.H
@@ -1,7 +1,7 @@
 //
 // Scroll header file for the Fast Light Tool Kit (FLTK).
 //
-// Copyright 1998-2015 by Bill Spitzak and others.
+// Copyright 1998-2021 by Bill Spitzak and others.
 //
 // This library is free software. Distribution and use rights are outlined in
 // the file "COPYING" which should have been included with this file.  If this
@@ -93,6 +93,27 @@ class FL_EXPORT Fl_Scroll : public Fl_Group {
   static void draw_clip(void*,int,int,int,int);
 
 protected:      //  (STR#1895)
+
+  /// A local struct to manage a region defined by xywh
+  typedef struct { int x,y,w,h; } Fl_Region_XYWH;
+
+  /// A local struct to manage a region defined by left/right/top/bottom
+  typedef struct {
+    int l;              ///< (l)eft "x" position, aka x1
+    int r;              ///< (r)ight "x" position, aka x2
+    int t;              ///< (t)op "y" position, aka y1
+    int b;              ///< (b)ottom "y" position, aka y2
+  } Fl_Region_LRTB;
+
+  /// A local struct to manage a scrollbar's xywh region and tab values
+  typedef struct {
+    int x,y,w,h;
+    int pos;            ///< scrollbar tab's "position of first line displayed"
+    int size;           ///< scrollbar tab's "size of window in lines"
+    int first;          ///< scrollbar tab's "number of first line"
+    int total;          ///< scrollbar tab's "total number of lines"
+  } Fl_Scrollbar_Data;
+
   /**
     Structure to manage scrollbar and widget interior sizes.
     This is filled out by recalc_scrollbars() for use in calculations
@@ -100,23 +121,6 @@ protected:      //  (STR#1895)
     \version 1.3.3
   */
   typedef struct {
-    /// A local struct to manage a region defined by xywh
-    typedef struct { int x,y,w,h; } Fl_Region_XYWH;
-    /// A local struct to manage a region defined by left/right/top/bottom
-    typedef struct {
-      int l;                    ///< (l)eft "x" position, aka x1
-      int r;                    ///< (r)ight "x" position, aka x2
-      int t;                    ///< (t)op "y" position, aka y1
-      int b;                    ///< (b)ottom "y" position, aka y2
-    } Fl_Region_LRTB;
-    /// A local struct to manage a scrollbar's xywh region and tab values
-    typedef struct {
-      int x,y,w,h;
-      int pos;                  ///< scrollbar tab's "position of first line displayed"
-      int size;                 ///< scrollbar tab's "size of window in lines"
-      int first;                ///< scrollbar tab's "number of first line"
-      int total;                ///< scrollbar tab's "total number of lines"
-    } Fl_Scrollbar_Data;
     int scrollsize;             ///< the effective scrollbar thickness (local or global)
     Fl_Region_XYWH innerbox;    ///< widget's inner box, excluding scrollbars
     Fl_Region_XYWH innerchild;  ///< widget's inner box, including scrollbars
Direct Link to Message ]
 
     
Previous Message ]Next Message ]
 
 

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'.