Fix compilation warnings

- add explicit cast on snprintf to prevent -Wsuggest-attribute=format warning
- always declare init_all_modules()
This commit is contained in:
Charlie Gordon 2022-08-12 11:48:55 +02:00
commit 26fbd52097
2 changed files with 5 additions and 4 deletions

4
qe.h
View file

@ -1340,6 +1340,8 @@ void eb_delete_properties(EditBuffer *b, int offset, int offset2);
#else /* QE_MODULE */
void init_all_modules(void);
#if (defined(__GNUC__) || defined(__TINYC__)) && defined(CONFIG_INIT_CALLS)
#if __GNUC__ < 3 || (__GNUC__ == 3 && __GNUC_MINOR__ < 3)
/* same method as the linux kernel... */
@ -1367,8 +1369,6 @@ void eb_delete_properties(EditBuffer *b, int offset, int offset2);
#define qe_module_exit(fn)
void init_all_modules(void);
#endif
#endif /* QE_MODULE */

View file

@ -429,8 +429,9 @@ static int qe_cfg_append(QEmacsDataSource *ds, QEValue *sp, const char *p, size_
static int qe_cfg_format(QEmacsDataSource *ds, QEValue *sp) {
char buf[256];
char fmt[16];
/* prevent warning on variable format */
int (*fun)(char *buf, size_t size, const char *fmt, ...) = snprintf;
/* Use function pointer and cast to prevent warning on variable format */
int (*fun)(char *buf, size_t size, const char *fmt, ...) =
(int (*)(char *buf, size_t size, const char *fmt, ...))snprintf;
char *start, *p;
int c, len;