1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-11-15 17:47:09 +00:00

Fix the "ISO C does not permit named variadic macros" in maintainer mode

and a few other that have cropped up in the process
This commit is contained in:
Pavel Labath 2010-11-12 19:33:17 +01:00
parent 561e1ea75d
commit 9a08141389
4 changed files with 29 additions and 18 deletions

View File

@ -3161,7 +3161,7 @@ char load_config_file(const char *f)
err = 1;
}
if (err) {
CONF_ERR2("default_bar_size takes 2 integer arguments (ie. 'default_bar_size 0 6')")
CONF_ERR2("default_bar_size takes 2 integer arguments (ie. 'default_bar_size 0 6')");
}
}
#ifdef BUILD_X11
@ -3175,7 +3175,7 @@ char load_config_file(const char *f)
err = 1;
}
if (err) {
CONF_ERR2("default_graph_size takes 2 integer arguments (ie. 'default_graph_size 0 6')")
CONF_ERR2("default_graph_size takes 2 integer arguments (ie. 'default_graph_size 0 6')");
}
}
CONF("default_gauge_size") {
@ -3188,7 +3188,7 @@ char load_config_file(const char *f)
err = 1;
}
if (err) {
CONF_ERR2("default_gauge_size takes 2 integer arguments (ie. 'default_gauge_size 0 6')")
CONF_ERR2("default_gauge_size takes 2 integer arguments (ie. 'default_gauge_size 0 6')");
}
}
#endif

View File

@ -30,17 +30,27 @@
#ifndef _LOGGING_H
#define _LOGGING_H
#include <cstdio>
#include <libintl.h>
#include "mail.h"
void clean_up(void *memtofree1, void* memtofree2);
void clean_up_without_threads(void *memtofree1, void* memtofree2);
#define NORM_ERR(format, args...) { \
template<typename... Args>
void gettextize_format(const char *format, Args&&... args)
{ fprintf(stderr, gettext(format), args...); }
// explicit specialization for no arguments to avoid the
// "format not a string literal and no format arguments" warning
inline void gettextize_format(const char *format)
{ fputs(gettext(format), stderr); }
#define NORM_ERR(...) do { \
fprintf(stderr, PACKAGE_NAME": "); \
fprintf(stderr, gettext(format), ##args); \
fprintf(stderr, "\n"); \
}
gettextize_format(__VA_ARGS__); \
fputs("\n", stderr); \
} while(0)
/* critical error */
#define CRIT_ERR(memtofree1, memtofree2, ...) \
@ -51,12 +61,13 @@ void clean_up_without_threads(void *memtofree1, void* memtofree2);
/* debugging output */
extern int global_debug_level;
#define __DBGP(level, format, args...) \
#define __DBGP(level, ...) do {\
if (global_debug_level > level) { \
fprintf(stderr, "DEBUG(%d) [" __FILE__ ":%d]: ", level, __LINE__); \
fprintf(stderr, gettext(format), ##args); \
fprintf(stderr, "\n"); \
}
gettextize_format(__VA_ARGS__); \
fputs("\n", stderr); \
} \
} while(0)
#define DBGP(...) __DBGP(0, __VA_ARGS__)
#define DBGP2(...) __DBGP(1, __VA_ARGS__)

View File

@ -24,9 +24,7 @@
*
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <thread>
#include <list>
@ -79,7 +77,7 @@ timed_thread::timed_thread(const std::function<void(thread_handle &)> &start_rou
{
#ifdef DEBUG
assert(interval_usecs >= MINIMUM_INTERVAL_USECS);
assert(interval_usecs >= std::chrono::microseconds(MINIMUM_INTERVAL_USECS));
#endif /* DEBUG */
/* create thread pipe (used to tell threads to die) */

View File

@ -28,6 +28,8 @@
*
*/
#include <config.h>
#include "logging.h"
#include <pwd.h>
#include <grp.h>
@ -50,10 +52,10 @@ void print_uid_name(struct text_object *obj, char *p, int p_max_size) {
if(pw != NULL) {
snprintf(p, p_max_size, "%s", pw->pw_name);
} else {
NORM_ERR("The uid %d doesn't exist", uid)
NORM_ERR("The uid %d doesn't exist", uid);
}
} else {
NORM_ERR("$uid_name didn't receive a uid as argument")
NORM_ERR("$uid_name didn't receive a uid as argument");
}
}
@ -72,9 +74,9 @@ void print_gid_name(struct text_object *obj, char *p, int p_max_size) {
if(grp != NULL) {
snprintf(p, p_max_size, "%s", grp->gr_name);
} else {
NORM_ERR("The gid %d doesn't exist", gid)
NORM_ERR("The gid %d doesn't exist", gid);
}
} else {
NORM_ERR("$gid_name didn't receive a gid as argument")
NORM_ERR("$gid_name didn't receive a gid as argument");
}
}