Commit 2d5cf2b4 authored by Christoph Reiter's avatar Christoph Reiter 🐍
Browse files

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().
parent c5829bd0
Pipeline #184016 passed with stages
in 29 minutes and 33 seconds
......@@ -27,18 +27,6 @@
/* Define to 1 if you have the `dcgettext' function. */
#mesondefine HAVE_DCGETTEXT
/* Define to 1 if you have the declaration of `isinf', and to 0 if you don't.
*/
#mesondefine HAVE_DECL_ISINF
/* Define to 1 if you have the declaration of `isnan', and to 0 if you don't.
*/
#mesondefine HAVE_DECL_ISNAN
/* Define to 1 if you have the declaration of `isnanf', and to 0 if you don't.
*/
#mesondefine HAVE_DECL_ISNANF
/* Define to 1 if you have the <dlfcn.h> header file. */
#mesondefine HAVE_DLFCN_H
......@@ -84,9 +72,6 @@
/* Define to 1 if you have a working `mmap' system call. */
#mesondefine HAVE_MMAP
/* Define to 1 if you have the `nearbyint' function. */
#mesondefine HAVE_NEARBYINT
/* Define to 1 if you have the `posix_fallocate' function. */
#mesondefine HAVE_POSIX_FALLOCATE
......@@ -96,21 +81,9 @@
/* Have the Xrandr 1.5 extension library */
#mesondefine HAVE_RANDR15
/* Define to 1 if you have the `rint' function. */
#mesondefine HAVE_RINT
/* Define to 1 if you have the `round' function. */
#mesondefine HAVE_ROUND
/* Define to 1 if you have the `sincos' function. */
#mesondefine HAVE_SINCOS
/* Define to 1 if you have the `log2` function */
#mesondefine HAVE_LOG2
/* Define to 1 if you ahve the `exp2` function */
#mesondefine HAVE_EXP2
/* Define to 1 if you have the <stdint.h> header file. */
#mesondefine HAVE_STDINT_H
......
/* 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 <float.h>
#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_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
/* 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
......@@ -26,9 +26,6 @@
#include "gdkintl.h"
#include "gdkkeysprivate.h"
/* for the use of round() */
#include "fallback-c89.c"
/**
* SECTION:gdkdevice
* @Short_description: Object representing an input device
......
......@@ -38,9 +38,6 @@
#include <math.h>
#include <glib.h>
/* for the use of round() */
#include "fallback-c89.c"
/**
* SECTION:gdkdisplay
* @Short_description: Controls a set of monitors and their associated input devices
......
......@@ -30,8 +30,6 @@
#include <errno.h>
#include <math.h>
#include "fallback-c89.c"
/**
* SECTION:rgba_colors
* @Short_description: RGBA colors
......
......@@ -47,9 +47,6 @@
#include <epoxy/gl.h>
/* for the use of round() */
#include "fallback-c89.c"
#ifdef GDK_WINDOWING_WAYLAND
#include "wayland/gdkwayland.h"
#endif
......
......@@ -49,7 +49,6 @@
#include <cairo-win32.h>
#include <dwmapi.h>
#include <math.h>
#include "fallback-c89.c"
static void gdk_surface_win32_finalize (GObject *object);
......
/* 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
......@@ -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
......
......@@ -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,
......
......@@ -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"
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -140,8 +140,6 @@
#include "a11y/gtklevelbaraccessible.h"
#include "fallback-c89.c"
enum {
PROP_VALUE = 1,
PROP_MIN_VALUE,
......
......@@ -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;
......
......@@ -43,8 +43,6 @@
#include <string.h>
#include "fallback-c89.c"
/**
* SECTION:gtkprogressbar
* @Short_description: A widget which indicates progress visually
......
......@@ -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,
......
......@@ -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,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment