FLTK logo

[master] 6ac305a - Remove compiler warnings '-Wextra-semi' (see also PR #266)

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] 6ac305a - Remove compiler warnings '-Wextra-semi' (see also PR #266) "Albrecht Schlosser" Aug 27, 2021  
 
commit 6ac305a50804498b8c7ab00d23d2d4f3164b84fa
Author:     Albrecht Schlosser <albrechts.fltk@online.de>
AuthorDate: Fri Aug 27 14:52:43 2021 +0200
Commit:     Albrecht Schlosser <albrechts.fltk@online.de>
CommitDate: Fri Aug 27 14:52:43 2021 +0200

    Remove compiler warnings '-Wextra-semi' (see also PR #266)
    
    I compiled with `-Wextra-semi -Werror=extra-semi` on Linux and Windows
    (cross-compiled on Linux) and removed all "extra semicolon" warnings
    I could find. I didn't check on macOS (yet).
    
    Note: Linux configured with and w/o Pango but not w/o Xft. Compilation
    with other options (e.g. Cairo) might still emit such warnings.

 FL/Fl_Device.H                                     |  6 ++--
 FL/Fl_File_Browser.H                               | 14 ++++----
 FL/Fl_File_Chooser.H                               |  2 +-
 FL/Fl_Paged_Device.H                               |  4 +--
 FL/Fl_SVG_Image.H                                  |  2 +-
 examples/clipboard.cxx                             |  2 +-
 examples/shapedwindow.cxx                          |  2 +-
 src/Fl_Image_Reader.h                              |  2 +-
 src/Fl_Native_File_Chooser_GTK.cxx                 |  4 +--
 src/drivers/Cairo/Fl_Cairo_Graphics_Driver.H       | 12 +++----
 src/drivers/OpenGL/Fl_OpenGL_Graphics_Driver.H     |  2 +-
 .../PostScript/Fl_PostScript_Graphics_Driver.H     | 22 ++++++-------
 src/gl_draw.cxx                                    |  2 +-
 test/boxtype.cxx                                   |  2 +-
 test/device.cxx                                    | 38 +++++++++++-----------
 test/rotated_text.cxx                              |  4 +--
 test/utf8.cxx                                      |  2 +-
 17 files changed, 61 insertions(+), 61 deletions(-)

diff --git FL/Fl_Device.H FL/Fl_Device.H
index 9615bdc..58f391c 100644
--- FL/Fl_Device.H
+++ FL/Fl_Device.H
@@ -73,19 +73,19 @@ protected:
   /** Constructor that sets the graphics driver to use for the created surface. */
   Fl_Surface_Device(Fl_Graphics_Driver *graphics_driver) {pGraphicsDriver = graphics_driver; }
   /** Sets the graphics driver of this drawing surface. */
-  inline void driver(Fl_Graphics_Driver *graphics_driver) {pGraphicsDriver = graphics_driver;};
+  inline void driver(Fl_Graphics_Driver *graphics_driver) {pGraphicsDriver = graphics_driver;}
 public:
   virtual void set_current(void);
   virtual bool is_current();
   /** \brief Returns the graphics driver of this drawing surface. */
-  inline Fl_Graphics_Driver *driver() {return pGraphicsDriver; };
+  inline Fl_Graphics_Driver *driver() {return pGraphicsDriver; }
   /** The current drawing surface.
    In other words, the Fl_Surface_Device object that currently receives all graphics requests.
    \note It's possible to transiently remove the GUI scaling factor in place in the current
    drawing surface with \ref fl_override_scale(). */
   static inline Fl_Surface_Device *surface() {
     return surface_ ? surface_ : default_surface();
-  };
+  }
   /** \brief The destructor. */
   virtual ~Fl_Surface_Device();
   static void push_current(Fl_Surface_Device *new_current);
diff --git FL/Fl_File_Browser.H FL/Fl_File_Browser.H
index 40d3280..8ea51b2 100644
--- FL/Fl_File_Browser.H
+++ FL/Fl_File_Browser.H
@@ -55,9 +55,9 @@ public:
   ~Fl_File_Browser();
 
   /**    Sets or gets the size of the icons. The default size is 20 pixels.  */
-  uchar         iconsize() const { return (iconsize_); };
+  uchar         iconsize() const { return (iconsize_); }
   /**    Sets or gets the size of the icons. The default size is 20 pixels.  */
-  void          iconsize(uchar s) { iconsize_ = s; redraw(); };
+  void          iconsize(uchar s) { iconsize_ = s; redraw(); }
 
   /**
     Sets or gets the filename filter. The pattern matching uses
@@ -70,10 +70,10 @@ public:
     the fl_filename_match()
     function in FLTK.
   */
-  const char    *filter() const { return (pattern_); };
+  const char    *filter() const { return (pattern_); }
   int           load(const char *directory, Fl_File_Sort_F *sort = fl_numericsort);
-  Fl_Fontsize  textsize() const { return Fl_Browser::textsize(); };
-  void          textsize(Fl_Fontsize s) { Fl_Browser::textsize(s); iconsize_ = (uchar)(3 * s / 2); };
+  Fl_Fontsize  textsize() const { return Fl_Browser::textsize(); }
+  void          textsize(Fl_Fontsize s) { Fl_Browser::textsize(s); iconsize_ = (uchar)(3 * s / 2); }
 
   /**
     Sets or gets the file browser type, FILES or
@@ -81,14 +81,14 @@ public:
     files and directories are shown. Otherwise only directories are
     shown.
   */
-  int           filetype() const { return (filetype_); };
+  int           filetype() const { return (filetype_); }
   /**
     Sets or gets the file browser type, FILES or
     DIRECTORIES. When set to FILES, both
     files and directories are shown. Otherwise only directories are
     shown.
   */
-  void          filetype(int t) { filetype_ = t; };
+  void          filetype(int t) { filetype_ = t; }
   void errmsg(const char *emsg);
   /**
     Returns OS error messages, or NULL if none. Use when advised.
diff --git FL/Fl_File_Chooser.H FL/Fl_File_Chooser.H
index 5935edc..57e0a97 100644
--- FL/Fl_File_Chooser.H
+++ FL/Fl_File_Chooser.H
@@ -142,7 +142,7 @@ public:
   void ok_label(const char *l);
   const char * ok_label();
   void preview(int e);
-  int preview() const { return previewButton->value(); };
+  int preview() const { return previewButton->value(); }
 private:
   void showHidden(int e);
   void remove_hidden_files();
diff --git FL/Fl_Paged_Device.H FL/Fl_Paged_Device.H
index 16b4124..cec4766 100644
--- FL/Fl_Paged_Device.H
+++ FL/Fl_Paged_Device.H
@@ -36,7 +36,7 @@
 class FL_EXPORT Fl_Paged_Device : public Fl_Widget_Surface {
 protected:
   /** \brief The constructor */
-  Fl_Paged_Device() : Fl_Widget_Surface(NULL) {};
+  Fl_Paged_Device() : Fl_Widget_Surface(NULL) {}
 public:
   /**
    Possible page formats.
@@ -99,7 +99,7 @@ public:
    */
   static const page_format page_formats[NO_PAGE_FORMATS];
   /** \brief The destructor */
-  virtual ~Fl_Paged_Device() {};
+  virtual ~Fl_Paged_Device() {}
   virtual int begin_job(int pagecount = 0, int *frompage = NULL, int *topage = NULL, char **perr_message = NULL);
   /** Synonym of begin_job(int pagecount, int *frompage, int *topage, char **perr_message).
    For API compatibility with FLTK 1.3.x */
diff --git FL/Fl_SVG_Image.H FL/Fl_SVG_Image.H
index 5fec922..2f98a2a 100644
--- FL/Fl_SVG_Image.H
+++ FL/Fl_SVG_Image.H
@@ -162,7 +162,7 @@ public:
   virtual void color_average(Fl_Color c, float i);
   virtual void draw(int X, int Y, int W, int H, int cx = 0, int cy = 0);
   void draw(int X, int Y) { draw(X, Y, w(), h(), 0, 0); }
-  virtual Fl_SVG_Image *as_svg_image() { return this; };
+  virtual Fl_SVG_Image *as_svg_image() { return this; }
   virtual void normalize();
 };
 
diff --git examples/clipboard.cxx examples/clipboard.cxx
index 4b4d921..e3aa322 100644
--- examples/clipboard.cxx
+++ examples/clipboard.cxx
@@ -69,7 +69,7 @@ public:
 
 class clipboard_viewer : public Fl_Tabs { // use tabs to display as appropriate the image or textual content of the clipboard
 public:
-  clipboard_viewer(int x, int y, int w, int h) : Fl_Tabs(x,y,w,h) {};
+  clipboard_viewer(int x, int y, int w, int h) : Fl_Tabs(x,y,w,h) {}
   virtual int handle(int event) {
     if (event != FL_PASTE) return Fl_Tabs::handle(event);
     if (strcmp(Fl::event_clipboard_type(), Fl::clipboard_image) == 0) { // an image is being pasted
diff --git examples/shapedwindow.cxx examples/shapedwindow.cxx
index cf4b704..cbc80f2 100644
--- examples/shapedwindow.cxx
+++ examples/shapedwindow.cxx
@@ -32,7 +32,7 @@ void cb(Fl_Widget *w, void *) {
 
 class dragbox : public Fl_Box {
 public:
-  dragbox(int x, int y, int w, int h, const char *t=0) : Fl_Box(x,y,w,h,t) {};
+  dragbox(int x, int y, int w, int h, const char *t=0) : Fl_Box(x,y,w,h,t) {}
   int handle(int event) {
     static int fromx, fromy, winx, winy;
     if (event == FL_PUSH) {
diff --git src/Fl_Image_Reader.h src/Fl_Image_Reader.h
index b013dc4..93f5edc 100644
--- src/Fl_Image_Reader.h
+++ src/Fl_Image_Reader.h
@@ -62,7 +62,7 @@ public:
   // Read a 32-bit signed integer, LSB-first
   int read_long() {
     return (int)read_dword();
-  };
+  }
 
   // Move the current read position to a byte offset from the beginning
   // of the file or the original start address in memory
diff --git src/Fl_Native_File_Chooser_GTK.cxx src/Fl_Native_File_Chooser_GTK.cxx
index 1087774..269405e 100644
--- src/Fl_Native_File_Chooser_GTK.cxx
+++ src/Fl_Native_File_Chooser_GTK.cxx
@@ -109,10 +109,10 @@ private:
     pair(Fl_GTK_Native_File_Chooser_Driver* c, const char *f) {
       running = c;
       filter = fl_strdup(f);
-    };
+    }
     ~pair() {
       free((char*)filter);
-    };
+    }
   };
   GtkWidget *gtkw_ptr; // used to hold a GtkWidget* without pulling GTK into everything...
   void *gtkw_slist; // used to hold a GLib GSList...
diff --git src/drivers/Cairo/Fl_Cairo_Graphics_Driver.H src/drivers/Cairo/Fl_Cairo_Graphics_Driver.H
index 09a5d67..aff73c4 100644
--- src/drivers/Cairo/Fl_Cairo_Graphics_Driver.H
+++ src/drivers/Cairo/Fl_Cairo_Graphics_Driver.H
@@ -48,7 +48,7 @@ public:
   int gap_;
   int pages_;
   cairo_t *cr() { return cairo_; }
-  PangoLayout *pango_layout() {return pango_layout_;};
+  PangoLayout *pango_layout() {return pango_layout_;}
 
   void check_status(void);
 
@@ -117,17 +117,17 @@ public:
   void end_line();
   void end_loop();
   void end_polygon();
-  void begin_complex_polygon(){begin_polygon();};
-  void gap(){gap_=1;};
-  void end_complex_polygon(){end_polygon();};
+  void begin_complex_polygon() { begin_polygon(); }
+  void gap() { gap_ = 1; }
+  void end_complex_polygon() { end_polygon(); }
   void transformed_vertex(double x, double y);
 
   void draw_image_mono(const uchar* d, int x,int y,int w,int h, int delta=1, int ld=0);
   void draw_image(Fl_Draw_Image_Cb call, void* data, int x,int y, int w, int h, int delta=3);
   void draw_image_mono(Fl_Draw_Image_Cb call, void* data, int x,int y, int w, int h, int delta=1);
 
-  void draw(const char* s, int nBytes, int x, int y) {transformed_draw(s,nBytes,x,y); };
-  void draw(const char* s, int nBytes, float x, float y) {transformed_draw(s,nBytes,x,y); };
+  void draw(const char* s, int nBytes, int x, int y) { transformed_draw(s,nBytes,x,y); }
+  void draw(const char* s, int nBytes, float x, float y) { transformed_draw(s,nBytes,x,y); }
   void draw(int angle, const char *str, int n, int x, int y);
   void rtl_draw(const char* s, int n, int x, int y);
   void draw_pixmap(Fl_Pixmap * pxm,int XP, int YP, int WP, int HP, int cx, int cy);
diff --git src/drivers/OpenGL/Fl_OpenGL_Graphics_Driver.H src/drivers/OpenGL/Fl_OpenGL_Graphics_Driver.H
index f240e76..9932f07 100644
--- src/drivers/OpenGL/Fl_OpenGL_Graphics_Driver.H
+++ src/drivers/OpenGL/Fl_OpenGL_Graphics_Driver.H
@@ -84,7 +84,7 @@ public:
   int descent();
   // ---
   Fl_Bitmask create_bitmask(int w, int h, const uchar *array) { return 0L; }
-  void delete_bitmask(Fl_Bitmask bm) { };
+  void delete_bitmask(Fl_Bitmask bm) { }
 };
 
 #endif // FL_OPENGL_GRAPHICS_DRIVER_H
diff --git src/drivers/PostScript/Fl_PostScript_Graphics_Driver.H src/drivers/PostScript/Fl_PostScript_Graphics_Driver.H
index 84ac2e4..4a05840 100644
--- src/drivers/PostScript/Fl_PostScript_Graphics_Driver.H
+++ src/drivers/PostScript/Fl_PostScript_Graphics_Driver.H
@@ -51,8 +51,8 @@ public:
 
   Fl_PostScript_Graphics_Driver();
   ~Fl_PostScript_Graphics_Driver();
-  void close_command(Fl_PostScript_Close_Command cmd){close_cmd_=cmd;};
-  FILE * file() {return output;};
+  void close_command(Fl_PostScript_Close_Command cmd){close_cmd_=cmd;}
+  FILE * file() {return output;}
   void page(double pw, double ph, int media = 0);
   void page(int format);
   int start_postscript (int pagecount, enum Fl_Paged_Device::Page_Format format, enum Fl_Paged_Device::Page_Layout layout);
@@ -112,7 +112,7 @@ public:
   int my; // mask lines
   int page_policy_;
   void page_policy(int p);
-  int page_policy(){return page_policy_;};
+  int page_policy() { return page_policy_; }
   int alpha_mask(const uchar * data, int w, int h, int D, int LD=0);
   /** Shields output PostScript data from modifications of the current locale.
    It typically avoids PostScript errors caused if the current locale uses comma instead of dot
@@ -154,11 +154,11 @@ public:
   enum Fl_Paged_Device::Page_Format page_format_;
   char *ps_filename_;
 
-  void close_command(Fl_PostScript_Close_Command cmd){close_cmd_=cmd;};
-  FILE * file() {return output;};
+  void close_command(Fl_PostScript_Close_Command cmd){close_cmd_=cmd;}
+  FILE * file() {return output;}
   //void orientation (int o);
   //Fl_PostScript_Graphics_Driver(FILE *o, int lang_level, int pages = 0); // ps (also multi-page) constructor
-  //void interpolate(int i){interpolate_=i;};
+  //void interpolate(int i){interpolate_=i;}
   //int interpolate(){return interpolate_;}
 
   void page(double pw, double ph, int media = 0);
@@ -211,9 +211,9 @@ public:
   void end_line();
   void end_loop();
   void end_polygon();
-  void begin_complex_polygon(){begin_polygon();};
-  void gap(){gap_=1;};
-  void end_complex_polygon(){end_polygon();};
+  void begin_complex_polygon(){begin_polygon();}
+  void gap(){gap_=1;}
+  void end_complex_polygon(){end_polygon();}
   void transformed_vertex(double x, double y);
 
   void draw_image(const uchar* d, int x,int y,int w,int h, int delta=3, int ldelta=0);
@@ -221,8 +221,8 @@ public:
   void draw_image(Fl_Draw_Image_Cb call, void* data, int x,int y, int w, int h, int delta=3);
   void draw_image_mono(Fl_Draw_Image_Cb call, void* data, int x,int y, int w, int h, int delta=1);
 
-  void draw(const char* s, int nBytes, int x, int y) {transformed_draw(s,nBytes,x,y); };
-  void draw(const char* s, int nBytes, float x, float y) {transformed_draw(s,nBytes,x,y); };
+  void draw(const char* s, int nBytes, int x, int y) {transformed_draw(s,nBytes,x,y); }
+  void draw(const char* s, int nBytes, float x, float y) {transformed_draw(s,nBytes,x,y); }
   void draw(int angle, const char *str, int n, int x, int y);
   void rtl_draw(const char* s, int n, int x, int y);
   void font(int face, int size);
diff --git src/gl_draw.cxx src/gl_draw.cxx
index c64506d..1ec4798 100644
--- src/gl_draw.cxx
+++ src/gl_draw.cxx
@@ -273,7 +273,7 @@ private:
   int already_known(const char *str, int n);
 public:
   gl_texture_fifo(int max = 100); // 100 = default height of texture pile
-  inline int size(void) {return size_; };
+  inline int size(void) {return size_; }
   ~gl_texture_fifo(void);
 };
 
diff --git test/boxtype.cxx test/boxtype.cxx
index 9f67f07..dc23318 100644
--- test/boxtype.cxx
+++ test/boxtype.cxx
@@ -51,7 +51,7 @@ static const int inactive  = 0; // deactivate boxes and use green background
 
 class BoxGroup : public Fl_Group {
   public:
-    BoxGroup(int x, int y, int w, int h) : Fl_Group(x,y,w,h) {};
+    BoxGroup(int x, int y, int w, int h) : Fl_Group(x,y,w,h) {}
     void draw() {
       draw_box();
       if (outline + box_bg) { // outline or box_bg or both
diff --git test/device.cxx test/device.cxx
index bb49413..3f67ce1 100644
--- test/device.cxx
+++ test/device.cxx
@@ -61,12 +61,12 @@ public:
   MyWidget(int x, int y):Fl_Box(x,y,100,100, "Clipping and rect(f):\nYellow rect.framed\nby B-Y-G-R rect. 1 p.\nthick. Your printer may \nrender very thin lines\nsurrounding \"X\""){
     align(FL_ALIGN_TOP);
     labelsize(10);
-  };
+  }
 };
 
-class MyWidget2: public Fl_Box{
+class MyWidget2: public Fl_Box {
 protected:
-  void draw(){
+  void draw() {
     Fl_Box::draw();
     int d;
     //    fl_line_style(0);
@@ -160,18 +160,18 @@ protected:
     fl_line(x()+61,y()+65, x()+59, y()+63);
 
     fl_color(FL_BLACK);
-  };
+  }
 
 public:
-  MyWidget2(int x, int y):Fl_Box(x,y,100,100, "Integer primitives"){
+  MyWidget2(int x, int y):Fl_Box(x,y,100,100, "Integer primitives") {
     labelsize(10);
     align(FL_ALIGN_TOP);
-  };
+  }
 };
 
-class MyWidget3: public Fl_Box{
+class MyWidget3: public Fl_Box {
 protected:
-  void draw(){
+  void draw() {
     Fl_Box::draw();
     double d;
     //    fl_line_style(0);
@@ -193,12 +193,12 @@ protected:
     }
     fl_pop_clip();
 
-  };
+  }
 public:
-  MyWidget3(int x, int y):Fl_Box(x,y,100,100, "Sub-pixel drawing of\nlines 1.63 points apart\nOn the screen you\ncan see aliasing, the\nprinter should render\nthem properly"){
+  MyWidget3(int x, int y):Fl_Box(x,y,100,100, "Sub-pixel drawing of\nlines 1.63 points apart\nOn the screen you\ncan see aliasing, the\nprinter should render\nthem properly") {
     labelsize(10);
     align(FL_ALIGN_TOP);
-  };
+  }
 };
 
 class MyWidget4: public Fl_Box{
@@ -355,15 +355,15 @@ protected:
     fl_pop_matrix();
 
     fl_color(FL_BLACK);
-  };
+  }
 public:
   MyWidget4(int x, int y):Fl_Box(x,y+10,150,150, "Line styles"){
     labelsize(10);
     align(FL_ALIGN_TOP);
-  };
+  }
 };
 
-class MyWidget5: public Fl_Box{
+class MyWidget5: public Fl_Box {
 protected:
   void draw(){
     Fl_Box::draw();
@@ -430,12 +430,12 @@ protected:
     fl_end_complex_polygon();
 
     fl_pop_matrix();
-  };
+  }
 public:
   MyWidget5(int x, int y):Fl_Box(x,y,230,250, "Complex (double) drawings:\nBlue ellipse may not be\ncorrectly transformed\ndue to non-orthogonal\ntransformation"){
     labelsize(10);
     align(FL_ALIGN_TOP);
-  };
+  }
 };
 
 uchar *image;
@@ -604,9 +604,9 @@ void copy(Fl_Widget *, void *data) {
   }
 }
 
-class My_Button:public Fl_Button{
+class My_Button:public Fl_Button {
 protected:
-  void draw(){
+  void draw() {
     if (type() == FL_HIDDEN_BUTTON) return;
     Fl_Color col = value() ? selection_color() : color();
     draw_box(value() ? (down_box()?down_box():fl_down(box())) : box(), col);
@@ -617,7 +617,7 @@ protected:
     fl_line_style(0);
     draw_label();
 
-  };
+  }
 public:
   My_Button(int x, int y, int w, int h, const char * label = 0):Fl_Button(x,y,w,h,label){}
 };
diff --git test/rotated_text.cxx test/rotated_text.cxx
index 4cc73a9..7c34bf8 100644
--- test/rotated_text.cxx
+++ test/rotated_text.cxx
@@ -97,9 +97,9 @@ class Rotated_Label_Box : public Fl_Widget{
 
   public:
   Rotated_Label_Box(int X, int Y, int W, int H, const char*L=0):
-    Fl_Widget(X,Y,W,H,L),rt_angle(0),rt_align((Fl_Align)0){
+    Fl_Widget(X,Y,W,H,L),rt_angle(0),rt_align((Fl_Align)0) {
       rt_text=input->value();
-    };
+    }
   int rt_angle;
   const char* rt_text;
   Fl_Align rt_align;
diff --git test/utf8.cxx test/utf8.cxx
index cfb4105..f4b8ff3 100644
--- test/utf8.cxx
+++ test/utf8.cxx
@@ -480,7 +480,7 @@ void box_cb(Fl_Widget* o, void*) {
 class right_left_input : public Fl_Input
 {
 public:
-  right_left_input (int x, int y, int w, int h) : Fl_Input(x, y, w, h) {};
+  right_left_input (int x, int y, int w, int h) : Fl_Input(x, y, w, h) {}
   void draw() {
     if (type() == FL_HIDDEN_INPUT) return;
     Fl_Boxtype b = box();
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'.