Merge branch 'fix-dll-compiler-warnings' into 'master'

Address dll compiler warnings

See merge request sane-project/backends!269
merge-requests/213/head
Ralph Little 2019-12-23 16:39:34 +00:00
commit 37f96cc800
1 zmienionych plików z 17 dodań i 2 usunięć

Wyświetl plik

@ -89,6 +89,20 @@ posix_dlsym (void *handle, const char *func)
}
# pragma GCC diagnostic pop
/* Similar to the above, GCC also warns about conversion between
pointers to functions. The ISO C standard says that invoking a
converted pointer to a function whose type is not compatible with
the pointed-to type, the behavior is undefined. Although GCC is
correct to warn about this, the dll backend has been using these
conversions without issues for a very long time already.
Rather than push/pop around every use, which would get very ugly
real fast, ignore this particular warning for the remainder of
the file.
*/
# pragma GCC diagnostic ignored "-Wpragmas" /* backward compatibility */
# pragma GCC diagnostic ignored "-Wcast-function-type"
/* Older versions of dlopen() don't define RTLD_NOW and RTLD_LAZY.
They all seem to use a mode of 1 to indicate RTLD_NOW and some do
not support RTLD_LAZY at all. Hence, unless defined, we define
@ -799,7 +813,8 @@ read_dlld (void)
DIR *dlld;
struct dirent *dllconf;
struct stat st;
char conffile[PATH_MAX], dlldir[PATH_MAX];
char dlldir[PATH_MAX];
char conffile[PATH_MAX + strlen("/") + NAME_MAX];
size_t len, plen;
const char *dir_list;
char *copy, *next, *dir;
@ -851,7 +866,7 @@ read_dlld (void)
|| (dllconf->d_name[len-1] == '#'))
continue;
snprintf (conffile, PATH_MAX, "%s/%s", dlldir, dllconf->d_name);
snprintf (conffile, sizeof(conffile), "%s/%s", dlldir, dllconf->d_name);
DBG (5, "sane_init/read_dlld: considering %s\n", conffile);