Deal consistently with including Imlib2.h

- Always include config.h before Imlib2.h
  Needed for X_DISPLAY_MISSING.
- Always include config.h and Imlib2.h first
  Should make it more likely to spot stuff missing but required
  in Imlib2.h, like stddef.h.
  gtest.h apparently must be included before X headers though.
- Make sure we use the Imlib2.h here and not the one in /usr/include

Also ensure that the tests build when building without X.
This commit is contained in:
Kim Woelders 2022-03-03 06:04:45 +01:00
parent b70777f38a
commit ac1d4b0520
26 changed files with 63 additions and 49 deletions

View File

@ -1,12 +1,11 @@
#include "config.h"
#include <Imlib2.h>
#include <X11/Xlib.h>
#include <X11/keysym.h>
#include <stdio.h>
#include <stdlib.h>
#include <Imlib2.h>
Display *disp;
Window win;

View File

@ -1,12 +1,11 @@
#include "config.h"
#include <Imlib2.h>
#include <X11/Xlib.h>
#include <X11/keysym.h>
#include <stdio.h>
#include <stdlib.h>
#include <Imlib2.h>
Display *disp;
Window win;

View File

@ -1,18 +1,18 @@
#include "config.h"
/* Convert images between formats, using Imlib2's API. Smart enough to know
* about edb files; defaults to jpg's.
/*
* Convert images between formats, using Imlib2's API.
* Defaults to jpg's.
*/
#include "config.h"
#ifndef X_DISPLAY_MISSING
#define X_DISPLAY_MISSING
#endif
#include <Imlib2.h>
#include <ctype.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#ifndef X_DISPLAY_MISSING
#define X_DISPLAY_MISSING
#endif
#include <Imlib2.h>
#define PROG_NAME "imlib2_conv"
static void usage(int exit_status);

View File

@ -1,12 +1,11 @@
#include "config.h"
#include <Imlib2.h>
#include <X11/Xlib.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <Imlib2.h>
Display *disp;
int image_width = 0, image_height = 0;

View File

@ -1,4 +1,9 @@
#include "config.h"
#ifndef X_DISPLAY_MISSING
#define X_DISPLAY_MISSING
#endif
#include <Imlib2.h>
#include <fcntl.h>
#include <stdbool.h>
#include <stdio.h>
@ -11,11 +16,6 @@
#include <sys/time.h>
#endif
#ifndef X_DISPLAY_MISSING
#define X_DISPLAY_MISSING
#endif
#include <Imlib2.h>
#define PROG_NAME "imlib2_load"
static char progress_called;

View File

@ -1,12 +1,11 @@
#include "config.h"
#include <Imlib2.h>
#include <X11/Xlib.h>
#include <X11/keysym.h>
#include <stdio.h>
#include <stdlib.h>
#include <Imlib2.h>
Display *disp;
Window win;

View File

@ -1,4 +1,5 @@
#include "config.h"
#include <Imlib2.h>
#include <X11/Xlib.h>
#include <X11/keysym.h>
@ -10,8 +11,6 @@
#include <math.h>
#include <locale.h>
#include <Imlib2.h>
Display *disp;
Window win;

View File

@ -1,12 +1,11 @@
#include "config.h"
#include <Imlib2.h>
#include <X11/Xlib.h>
#include <X11/keysym.h>
#include <stdio.h>
#include <stdlib.h>
#include <Imlib2.h>
/* some globals for our window & X display */
Display *disp;
Window win;

View File

@ -1,4 +1,5 @@
#include "config.h"
#include <Imlib2.h>
#include <X11/Xlib.h>
#include <X11/keysym.h>
@ -8,7 +9,6 @@
#include <stdbool.h>
#include <unistd.h>
#include <Imlib2.h>
#include "props.h"
#define MIN(a, b) ((a < b) ? a : b)

View File

@ -35,6 +35,7 @@
#define IMLIB2_DEPRECATED
#endif
#include <stddef.h>
#ifndef X_DISPLAY_MISSING
#include <X11/Xlib.h>
#endif

View File

@ -1,10 +1,10 @@
#include "config.h"
#include <Imlib2.h>
#include <math.h>
#include <string.h>
#include <stdarg.h>
#include "Imlib2.h"
#include "blend.h"
#include "colormod.h"
#include "color_helpers.h"

View File

@ -1,9 +1,8 @@
/*
* Obsolete, useless code
*/
#include <stddef.h>
#include "config.h"
#include "Imlib2.h"
#include <Imlib2.h>
EAPI void
imlib_image_set_irrelevant_border(char irrelevant)

View File

@ -1,4 +1,5 @@
#include "common.h"
#include "config.h"
#include <Imlib2.h>
#include <ctype.h>
#include <errno.h>
@ -8,7 +9,7 @@
#include <sys/types.h>
#include <sys/stat.h>
#include "Imlib2.h"
#include "common.h"
#include "debug.h"
#include "file.h"
#include "image.h"

View File

@ -1,4 +1,5 @@
#include "common.h"
#include "config.h"
#include <Imlib2.h>
#include <ctype.h>
#include <errno.h>
@ -11,7 +12,7 @@
#include <sys/types.h>
#include <sys/stat.h>
#include "Imlib2.h"
#include "common.h"
#include "dynamic_filters.h"
#include "image.h"
#include "script.h"

View File

@ -1,5 +1,5 @@
AM_CFLAGS = $(CFLAGS_WARNINGS) $(CFLAGS_VISIBILITY) $(CFLAGS_ASAN)
AM_CPPFLAGS = -I$(top_builddir) -I$(top_srcdir)/src/lib
AM_CPPFLAGS = -I$(top_builddir) -I$(top_builddir)/src/lib -I$(top_srcdir)/src/lib
pkgdir = $(libdir)/imlib2/filters
pkg_LTLIBRARIES = testfilter.la bumpmap.la colormod.la

View File

@ -1,7 +1,10 @@
#include "filter_common.h"
#include "config.h"
#include <Imlib2.h>
#include <string.h>
#include <math.h>
#include <Imlib2.h>
#include "filter_common.h"
#include "colormod.h"
#include "blend.h"

View File

@ -1,7 +1,10 @@
#include "filter_common.h"
#include "config.h"
#include <Imlib2.h>
#include <string.h>
#include <math.h>
#include <Imlib2.h>
#include "filter_common.h"
#define GET_INT(x, ptr) (((ptr)->type == VAR_PTR) ? \
(x) = (*(int *)(ptr)->data) : \

View File

@ -1,7 +1,10 @@
#include "filter_common.h"
#include <string.h>
#include "config.h"
#include <Imlib2.h>
#include <string.h>
#include "filter_common.h"
void
init(ImlibFilterInfo * info)
{

View File

@ -11,9 +11,11 @@ CLEANFILES = file.c img_save-*.*
GTESTS += test_load
GTESTS += test_load_2
GTESTS += test_save
GTESTS += test_grab
GTESTS += test_scale
GTESTS += test_rotate
if BUILD_X11
GTESTS += test_grab
endif
AM_CFLAGS = -Wall -Wextra -Werror -Wno-unused-parameter
AM_CFLAGS += $(CFLAGS_ASAN)

View File

@ -1,8 +1,10 @@
#include <gtest/gtest.h>
#include <stddef.h>
#include "config.h"
#include <Imlib2.h>
#include <stddef.h>
#include "test.h"
#define NULC ((Imlib_Context*)0)

View File

@ -1,9 +1,10 @@
#include <gtest/gtest.h>
#include <X11/Xutil.h>
#include "config.h"
#include <Imlib2.h>
#include "config.h"
#include <X11/Xutil.h>
#include "test.h"
typedef struct {

View File

@ -1,9 +1,10 @@
#include <gtest/gtest.h>
#include "config.h"
#include <Imlib2.h>
#include <fcntl.h>
#include "config.h"
#include "test.h"
#define EXPECT_OK(x) EXPECT_FALSE(x)

View File

@ -1,10 +1,11 @@
#include <gtest/gtest.h>
#include "config.h"
#include <Imlib2.h>
#include <fcntl.h>
#include <zlib.h>
#include "config.h"
#include "test.h"
#define EXPECT_OK(x) EXPECT_FALSE(x)

View File

@ -1,9 +1,10 @@
#include <gtest/gtest.h>
#include "config.h"
#include <Imlib2.h>
#include <zlib.h>
#include "config.h"
#include "test.h"
#define FILE_REF1 "icon-64" // RGB

View File

@ -1,8 +1,8 @@
#include <gtest/gtest.h>
#include "config.h"
#include <Imlib2.h>
#include "config.h"
#include "test.h"
#define EXPECT_OK(x) EXPECT_FALSE(x)

View File

@ -1,9 +1,10 @@
#include <gtest/gtest.h>
#include "config.h"
#include <Imlib2.h>
#include <zlib.h>
#include "config.h"
#include "test.h"
#define FILE_REF1 "icon-64" // RGB