Fix a bunch of compiler warnings, particularly for old compilers
Works now much better with old C99 and C++98 standard compilers. Fixed: C++ comments in C files and headers included by C files. There are still some warnings with C90 though but these would be hard to fix and left as-is for now. test/fractals.cxx: some arrays were too small by 1, or the compiler warned at least (false positive?). Anyway, it's fixed now.
This commit is contained in:
parent
b3e1df3584
commit
8b094e8af3
12
FL/fl_attr.h
12
FL/fl_attr.h
@ -146,7 +146,7 @@
|
|||||||
|
|
||||||
// -- nothing yet --
|
// -- nothing yet --
|
||||||
|
|
||||||
#endif // __clang__
|
#endif /* __clang__ */
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -162,19 +162,19 @@
|
|||||||
#define __fl_attr(x) __attribute__ (x)
|
#define __fl_attr(x) __attribute__ (x)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if FL_GCC_VERSION > 40500 // gcc 4.5.0
|
#if FL_GCC_VERSION > 40500 /* gcc 4.5.0 */
|
||||||
#ifndef FL_DEPRECATED
|
#ifndef FL_DEPRECATED
|
||||||
#define FL_DEPRECATED(msg, func) func __attribute__((deprecated(msg)))
|
#define FL_DEPRECATED(msg, func) func __attribute__((deprecated(msg)))
|
||||||
#endif
|
#endif
|
||||||
#endif // gcc 4.5.0
|
#endif /* gcc 4.5.0 */
|
||||||
|
|
||||||
#if FL_GCC_VERSION > 30100 // gcc 3.1.0
|
#if FL_GCC_VERSION > 30100 /* gcc 3.1.0 */
|
||||||
#ifndef FL_DEPRECATED
|
#ifndef FL_DEPRECATED
|
||||||
#define FL_DEPRECATED(msg, func) func __attribute__((deprecated))
|
#define FL_DEPRECATED(msg, func) func __attribute__((deprecated))
|
||||||
#endif
|
#endif
|
||||||
#endif // gcc 3.1.0
|
#endif /* gcc 3.1.0 */
|
||||||
|
|
||||||
#endif // __GNUC__
|
#endif /* __GNUC__ */
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@ -138,7 +138,7 @@ extern FL_EXPORT int fl_control_modifier();
|
|||||||
|
|
||||||
#endif /* FL_PLATFORM_TYPES_H */
|
#endif /* FL_PLATFORM_TYPES_H */
|
||||||
|
|
||||||
// This is currently the same for all platforms, but may change in the future
|
/* This is currently the same for all platforms but may change in the future */
|
||||||
struct Fl_Timestamp_t {
|
struct Fl_Timestamp_t {
|
||||||
time_t sec;
|
time_t sec;
|
||||||
int usec;
|
int usec;
|
||||||
|
|||||||
@ -82,8 +82,8 @@ FL_EXPORT extern size_t fl_strlcat(char *, const char *, size_t);
|
|||||||
# define strlcat fl_strlcat
|
# define strlcat fl_strlcat
|
||||||
# endif /* !HAVE_STRLCAT */
|
# endif /* !HAVE_STRLCAT */
|
||||||
|
|
||||||
// promoted to <FL/fl_string_functions.h>
|
/* promoted to <FL/fl_string_functions.h> */
|
||||||
//FL_EXPORT extern size_t fl_strlcpy(char *, const char *, size_t);
|
/* FL_EXPORT extern size_t fl_strlcpy(char *, const char *, size_t); */
|
||||||
# ifndef HAVE_STRLCPY
|
# ifndef HAVE_STRLCPY
|
||||||
# define strlcpy fl_strlcpy
|
# define strlcpy fl_strlcpy
|
||||||
# endif /* !HAVE_STRLCPY */
|
# endif /* !HAVE_STRLCPY */
|
||||||
|
|||||||
@ -73,7 +73,6 @@ static int numericsort(struct dirent **A, struct dirent **B, int cs) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (a >= end_a) break;
|
if (a >= end_a) break;
|
||||||
//a++; b++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!ret) return 0;
|
if (!ret) return 0;
|
||||||
|
|||||||
@ -37,7 +37,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/* The ARM header files have a bug by not taking into account that ARM cpu
|
/* The ARM header files have a bug by not taking into account that ARM cpu
|
||||||
* likes packing to 4 bytes. This little trick defines our own version of
|
* likes padding to 4 bytes. This little trick defines our own version of
|
||||||
* XChar2b which does not have this problem
|
* XChar2b which does not have this problem
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
// demonstrate how to add FLTK controls to a GLUT program. The GLUT
|
// demonstrate how to add FLTK controls to a GLUT program. The GLUT
|
||||||
// code is unchanged except for the end (search for FLTK to find changes).
|
// code is unchanged except for the end (search for FLTK to find changes).
|
||||||
//
|
//
|
||||||
// Copyright 1998-2016 by Bill Spitzak and others.
|
// Copyright 1998-2024 by Bill Spitzak and others.
|
||||||
//
|
//
|
||||||
// This library is free software. Distribution and use rights are outlined in
|
// 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
|
// the file "COPYING" which should have been included with this file. If this
|
||||||
@ -77,6 +77,7 @@ typedef enum { NOTALLOWED, MOUNTAIN, TREE, ISLAND, BIGMTN, STEM, LEAF,
|
|||||||
MOUNTAIN_MAT, WATER_MAT, LEAF_MAT, TREE_MAT, STEMANDLEAVES,
|
MOUNTAIN_MAT, WATER_MAT, LEAF_MAT, TREE_MAT, STEMANDLEAVES,
|
||||||
AXES } DisplayLists;
|
AXES } DisplayLists;
|
||||||
|
|
||||||
|
// Note: MAXLEVEL is the highest level, range is 0..MAXLEVEL
|
||||||
#define MAXLEVEL 8
|
#define MAXLEVEL 8
|
||||||
|
|
||||||
int Rebuild = 1, /* Rebuild display list in next display? */
|
int Rebuild = 1, /* Rebuild display list in next display? */
|
||||||
@ -146,11 +147,11 @@ float xzslope(float v1[3], float v2[3])
|
|||||||
/************************ MOUNTAIN STUFF ***********************/
|
/************************ MOUNTAIN STUFF ***********************/
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
|
|
||||||
GLfloat DispFactor[MAXLEVEL]; /* Array of what to multiply random number
|
GLfloat DispFactor[MAXLEVEL + 1]; /* Array of what to multiply random number
|
||||||
by for a given level to get midpoint
|
by for a given level to get midpoint
|
||||||
displacement */
|
displacement */
|
||||||
GLfloat DispBias[MAXLEVEL]; /* Array of what to add to random number
|
GLfloat DispBias[MAXLEVEL + 1]; /* Array of what to add to random number
|
||||||
before multiplying it by DispFactor */
|
before multiplying it by DispFactor */
|
||||||
|
|
||||||
#define NUMRANDS 191
|
#define NUMRANDS 191
|
||||||
float RandTable[NUMRANDS]; /* hash table of random numbers so we can
|
float RandTable[NUMRANDS]; /* hash table of random numbers so we can
|
||||||
@ -233,9 +234,9 @@ void FMR(GLfloat v1[3], GLfloat v2[3], GLfloat v3[3], int level)
|
|||||||
void FractalMountain(GLfloat v1[3], GLfloat v2[3], GLfloat v3[3],
|
void FractalMountain(GLfloat v1[3], GLfloat v2[3], GLfloat v3[3],
|
||||||
int pegged[3])
|
int pegged[3])
|
||||||
{
|
{
|
||||||
GLfloat lengths[MAXLEVEL];
|
GLfloat lengths[MAXLEVEL + 1];
|
||||||
GLfloat fraction[8] = { 0.3f, 0.3f, 0.4f, 0.2f, 0.3f, 0.2f, 0.4f, 0.4f };
|
GLfloat fraction[8] = { 0.3f, 0.3f, 0.4f, 0.2f, 0.3f, 0.2f, 0.4f, 0.4f };
|
||||||
GLfloat bias[8] = { 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f };
|
GLfloat bias[8] = { 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f };
|
||||||
int i;
|
int i;
|
||||||
float avglen = (xzlength(v1, v2) +
|
float avglen = (xzlength(v1, v2) +
|
||||||
xzlength(v2, v3) +
|
xzlength(v2, v3) +
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user