summaryrefslogtreecommitdiff
path: root/gtk
diff options
context:
space:
mode:
authorChristoph Reiter <reiter.christoph@gmail.com>2020-05-31 16:06:07 +0200
committerChristoph Reiter <reiter.christoph@gmail.com>2020-05-31 17:09:23 +0200
commit2d5cf2b4c4b11b2df01363133be80fe25b79252d (patch)
treeb393eeb50596ffbfbb5f106626e4d4eecfe36917 /gtk
parentc5829bd0e2134ed9f05fe9d6fbe1f3156a00352e (diff)
downloadgtk+-2d5cf2b4c4b11b2df01363133be80fe25b79252d.tar.gz
Drop fallback-c89.c
We require a C compiler supporting C99 now. The main purpose of these fallbacks was for MSVC. From what I can see this is now all supported by MSVC 2015+ anyway. The only other change this includes is to replace isnanf() with the (type infering) C99 isnan() macro, because MSVC doesn't provide isnanf().
Diffstat (limited to 'gtk')
-rw-r--r--gtk/fallback-c89.c140
-rw-r--r--gtk/gtkcssshorthandpropertyimpl.c5
-rw-r--r--gtk/gtkcssstyleproperty.c5
-rw-r--r--gtk/gtkcssstylepropertyimpl.c5
-rw-r--r--gtk/gtkentry.c2
-rw-r--r--gtk/gtkicontheme.c5
-rw-r--r--gtk/gtkkineticscrolling.c3
-rw-r--r--gtk/gtklabel.c5
-rw-r--r--gtk/gtklevelbar.c2
-rw-r--r--gtk/gtknumericsorter.c7
-rw-r--r--gtk/gtkprogressbar.c2
-rw-r--r--gtk/gtkrender.c2
-rw-r--r--gtk/gtkrenderbackground.c5
-rw-r--r--gtk/gtkrenderborder.c5
-rw-r--r--gtk/gtkrevealer.c2
-rw-r--r--gtk/gtkswitch.c2
-rw-r--r--gtk/gtktext.c2
-rw-r--r--gtk/gtkwidget.c3
-rw-r--r--gtk/inspector/visual.c2
-rw-r--r--gtk/meson.build1
20 files changed, 4 insertions, 201 deletions
diff --git a/gtk/fallback-c89.c b/gtk/fallback-c89.c
deleted file mode 100644
index 65cb53589e..0000000000
--- a/gtk/fallback-c89.c
+++ /dev/null
@@ -1,140 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 2011 Chun-wei Fan <fanc999@yahoo.com.tw>
- *
- * Author: Chun-wei Fan <fanc999@yahoo.com.tw>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "config.h"
-
-#include <math.h>
-#include <float.h>
-
-/* Workaround for round() for non-GCC/non-C99 compilers */
-#ifndef HAVE_ROUND
-static inline double
-round (double x)
-{
- if (x >= 0)
- return floor (x + 0.5);
- else
- return ceil (x - 0.5);
-}
-#endif
-
-/* Workaround for rint() for non-GCC/non-C99 compilers */
-#ifndef HAVE_RINT
-static inline double
-rint (double x)
-{
- if (ceil (x + 0.5) == floor (x + 0.5))
- {
- int a;
- a = (int) ceil (x);
- if (a % 2 == 0)
- return ceil (x);
- else
- return floor (x);
- }
- else
- {
- if (x >= 0)
- return floor (x + 0.5);
- else
- return ceil (x - 0.5);
- }
-}
-#endif
-
-#ifndef HAVE_NEARBYINT
-/* Workaround for nearbyint() for non-GCC/non-C99 compilers */
-/* This is quite similar to rint() in most respects */
-
-static inline double
-nearbyint (double x)
-{
- return floor (x + 0.5);
-}
-#endif
-
-#ifndef HAVE_DECL_ISINF
-/* Unfortunately MSVC does not have finite()
- * but it does have _finite() which is the same
- * as finite() except when x is a NaN
- */
-static inline gboolean
-isinf (double x)
-{
- return (!_finite (x) && !_isnan (x));
-}
-#endif
-
-#ifndef HAVE_DECL_ISNAN
-/* it seems of the supported compilers only
- * MSVC does not have isnan(), but it does
- * have _isnan() which does the same as isnan()
- */
-static inline gboolean
-isnan (double x)
-{
- return _isnan (x);
-}
-#endif
-
-#ifndef HAVE_DECL_ISNANF
-#if defined (__GNUC__)
-/* gcc has an intern function that it warns about when
- * using -Wshadow but no header properly declares it,
- * so we do it instead.
- */
-extern int isnanf (float x);
-#else
-static inline int
-isnanf (float x)
-{
- /* Either use the C99 type infering macro, or the fallback from above.
- * MSVC has _isnanf, but only on x64
- */
- return isnan (x);
-}
-#endif
-#endif
-
-#ifndef INFINITY
-/* define INFINITY for compilers that lack support for it */
-# ifdef HUGE_VALF
-# define INFINITY HUGE_VALF
-# else
-# define INFINITY (float)HUGE_VAL
-# endif
-#endif
-
-#ifndef HAVE_LOG2
-/* Use a simple implementation for log2() for compilers that lack it */
-static inline double
-log2 (double x)
-{
- return log (x) / log (2.0);
-}
-#endif
-
-#ifndef HAVE_EXP2
-/* Use a simple implementation for exp2() for compilers that lack it */
-static inline double
-exp2 (double x)
-{
- return pow (2.0, x);
-}
-#endif
diff --git a/gtk/gtkcssshorthandpropertyimpl.c b/gtk/gtkcssshorthandpropertyimpl.c
index 82b5893151..4a9b97fd07 100644
--- a/gtk/gtkcssshorthandpropertyimpl.c
+++ b/gtk/gtkcssshorthandpropertyimpl.c
@@ -40,11 +40,6 @@
#include "gtkcssvalueprivate.h"
#include "gtktypebuiltins.h"
-/* this is in case round() is not provided by the compiler,
- * such as in the case of C89 compilers, like MSVC
- */
-#include "fallback-c89.c"
-
/*** PARSING ***/
static gboolean
diff --git a/gtk/gtkcssstyleproperty.c b/gtk/gtkcssstyleproperty.c
index 0fe1bab134..eebf39ad48 100644
--- a/gtk/gtkcssstyleproperty.c
+++ b/gtk/gtkcssstyleproperty.c
@@ -30,11 +30,6 @@
#include "gtkprivatetypebuiltins.h"
#include "gtkprivate.h"
-/* this is in case round() is not provided by the compiler,
- * such as in the case of C89 compilers, like MSVC
- */
-#include "fallback-c89.c"
-
enum {
PROP_0,
PROP_ANIMATED,
diff --git a/gtk/gtkcssstylepropertyimpl.c b/gtk/gtkcssstylepropertyimpl.c
index 94cd77f6a1..eabafee6df 100644
--- a/gtk/gtkcssstylepropertyimpl.c
+++ b/gtk/gtkcssstylepropertyimpl.c
@@ -29,11 +29,6 @@
#include "gtkintl.h"
#include "gtkprivatetypebuiltins.h"
-/* this is in case round() is not provided by the compiler,
- * such as in the case of C89 compilers, like MSVC
- */
-#include "fallback-c89.c"
-
/* the actual parsers we have */
#include "gtkcssarrayvalueprivate.h"
#include "gtkcssbgsizevalueprivate.h"
diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c
index 7a30849846..3bb4178da6 100644
--- a/gtk/gtkentry.c
+++ b/gtk/gtkentry.c
@@ -75,8 +75,6 @@
#include <cairo-gobject.h>
#include <string.h>
-#include "fallback-c89.c"
-
/**
* SECTION:gtkentry
* @Short_description: A single line text entry field
diff --git a/gtk/gtkicontheme.c b/gtk/gtkicontheme.c
index c29d2b7a8a..1b40a1e438 100644
--- a/gtk/gtkicontheme.c
+++ b/gtk/gtkicontheme.c
@@ -55,11 +55,6 @@
#include "gdk/gdktextureprivate.h"
#include "gdk/gdkprofilerprivate.h"
-/* this is in case round() is not provided by the compiler,
- * such as in the case of C89 compilers, like MSVC
- */
-#include "fallback-c89.c"
-
/**
* SECTION:gtkicontheme
* @Short_description: Looking up icons by name
diff --git a/gtk/gtkkineticscrolling.c b/gtk/gtkkineticscrolling.c
index 7acd096680..212319b933 100644
--- a/gtk/gtkkineticscrolling.c
+++ b/gtk/gtkkineticscrolling.c
@@ -18,10 +18,9 @@
#include "config.h"
#include "gtkkineticscrollingprivate.h"
+#include <math.h>
#include <stdio.h>
-#include "fallback-c89.c"
-
/*
* All our curves are second degree linear differential equations, and
* so they can always be written as linear combinations of 2 base
diff --git a/gtk/gtklabel.c b/gtk/gtklabel.c
index 688c4b3460..3a8e675c85 100644
--- a/gtk/gtklabel.c
+++ b/gtk/gtklabel.c
@@ -63,11 +63,6 @@
#include <math.h>
#include <string.h>
-/* this is in case rint() is not provided by the compiler,
- * such as in the case of C89 compilers, like MSVC
- */
-#include "fallback-c89.c"
-
/**
* SECTION:gtklabel
* @Short_description: A widget that displays a small to medium amount of text
diff --git a/gtk/gtklevelbar.c b/gtk/gtklevelbar.c
index d00a03f1f3..caafb489f4 100644
--- a/gtk/gtklevelbar.c
+++ b/gtk/gtklevelbar.c
@@ -140,8 +140,6 @@
#include "a11y/gtklevelbaraccessible.h"
-#include "fallback-c89.c"
-
enum {
PROP_VALUE = 1,
PROP_MIN_VALUE,
diff --git a/gtk/gtknumericsorter.c b/gtk/gtknumericsorter.c
index 253fd201d7..eac561241b 100644
--- a/gtk/gtknumericsorter.c
+++ b/gtk/gtknumericsorter.c
@@ -25,7 +25,6 @@
#include "gtktypebuiltins.h"
#include <math.h>
-#include "fallback-c89.c"
/**
* SECTION:gtknumericsorter
@@ -127,11 +126,11 @@ gtk_numeric_sorter_compare (GtkSorter *sorter,
float num1 = g_value_get_float (&value1);
float num2 = g_value_get_float (&value2);
- if (isnanf (num1) && isnanf (num2))
+ if (isnan (num1) && isnan (num2))
result = GTK_ORDERING_EQUAL;
- else if (isnanf (num1))
+ else if (isnan (num1))
result = self->sort_order == GTK_SORT_ASCENDING ? GTK_ORDERING_LARGER : GTK_ORDERING_SMALLER;
- else if (isnanf (num2))
+ else if (isnan (num2))
result = self->sort_order == GTK_SORT_ASCENDING ? GTK_ORDERING_SMALLER : GTK_ORDERING_LARGER;
else if (num1 < num2)
result = self->sort_order == GTK_SORT_ASCENDING ? GTK_ORDERING_SMALLER : GTK_ORDERING_LARGER;
diff --git a/gtk/gtkprogressbar.c b/gtk/gtkprogressbar.c
index 83f2aeaf89..58164c4e7e 100644
--- a/gtk/gtkprogressbar.c
+++ b/gtk/gtkprogressbar.c
@@ -43,8 +43,6 @@
#include <string.h>
-#include "fallback-c89.c"
-
/**
* SECTION:gtkprogressbar
* @Short_description: A widget which indicates progress visually
diff --git a/gtk/gtkrender.c b/gtk/gtkrender.c
index c11e377aaf..6ddfa4998a 100644
--- a/gtk/gtkrender.c
+++ b/gtk/gtkrender.c
@@ -34,8 +34,6 @@
#include "gsk/gskroundedrectprivate.h"
#include <gdk/gdktextureprivate.h>
-#include "fallback-c89.c"
-
static void
gtk_do_render_icon (GtkStyleContext *context,
cairo_t *cr,
diff --git a/gtk/gtkrenderbackground.c b/gtk/gtkrenderbackground.c
index e366188852..fb17730900 100644
--- a/gtk/gtkrenderbackground.c
+++ b/gtk/gtkrenderbackground.c
@@ -43,11 +43,6 @@
#include "gsk/gskroundedrectprivate.h"
-/* this is in case round() is not provided by the compiler,
- * such as in the case of C89 compilers, like MSVC
- */
-#include "fallback-c89.c"
-
static void
gtk_theming_background_snapshot_color (GtkCssBoxes *boxes,
GtkSnapshot *snapshot,
diff --git a/gtk/gtkrenderborder.c b/gtk/gtkrenderborder.c
index e56d48e16c..1846ace0f9 100644
--- a/gtk/gtkrenderborder.c
+++ b/gtk/gtkrenderborder.c
@@ -39,11 +39,6 @@
#include "gsk/gskroundedrectprivate.h"
-/* this is in case round() is not provided by the compiler,
- * such as in the case of C89 compilers, like MSVC
- */
-#include "fallback-c89.c"
-
typedef struct _GtkBorderImage GtkBorderImage;
struct _GtkBorderImage {
diff --git a/gtk/gtkrevealer.c b/gtk/gtkrevealer.c
index 74fdf52f90..158152480c 100644
--- a/gtk/gtkrevealer.c
+++ b/gtk/gtkrevealer.c
@@ -32,8 +32,6 @@
#include "gtkwidgetprivate.h"
#include "gtkbuildable.h"
-#include "fallback-c89.c"
-
/**
* SECTION:gtkrevealer
* @Short_description: Hide and show with animation
diff --git a/gtk/gtkswitch.c b/gtk/gtkswitch.c
index 79f0b5c652..99ac45f941 100644
--- a/gtk/gtkswitch.c
+++ b/gtk/gtkswitch.c
@@ -71,8 +71,6 @@
#include "a11y/gtkswitchaccessible.h"
-#include "fallback-c89.c"
-
typedef struct _GtkSwitchClass GtkSwitchClass;
/**
diff --git a/gtk/gtktext.c b/gtk/gtktext.c
index 5e6ee4be75..77c469636f 100644
--- a/gtk/gtktext.c
+++ b/gtk/gtktext.c
@@ -73,8 +73,6 @@
#include <cairo-gobject.h>
#include <string.h>
-#include "fallback-c89.c"
-
/**
* SECTION:gtktext
* @Short_description: A simple single-line text entry field
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 96f4656d4c..18a6b048fa 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -90,9 +90,6 @@
#include <stdarg.h>
#include <string.h>
-/* for the use of round() */
-#include "fallback-c89.c"
-
/**
* SECTION:gtkwidget
* @Short_description: Base class for all widgets
diff --git a/gtk/inspector/visual.c b/gtk/inspector/visual.c
index 4840f72926..7f1b40d635 100644
--- a/gtk/inspector/visual.c
+++ b/gtk/inspector/visual.c
@@ -45,8 +45,6 @@
#include "gtkeditable.h"
#include "gtkentry.h"
-#include "fallback-c89.c"
-
#ifdef GDK_WINDOWING_X11
#include "x11/gdkx.h"
#endif
diff --git a/gtk/meson.build b/gtk/meson.build
index 448de76888..c8ebb97168 100644
--- a/gtk/meson.build
+++ b/gtk/meson.build
@@ -14,7 +14,6 @@ gtk_cargs = [
# List of sources that do not contain public API, and should not be
# introspected
gtk_private_sources = files([
- 'fallback-c89.c',
'fnmatch.c',
'tools/gdkpixbufutils.c',
'gsettings-mapping.c',