Fix warning ISO C does not support __FUNCTION__

"warning: ISO C does not support ‘__FUNCTION__’ predefined identifier"

Among others -Wpedantic now warns about non-standard predefined identifiers.
The fix is either to use the standard predefined identifier __func__ (since C99),
or to use the __extension__ keyword.
This commit is contained in:
fafryd 2017-10-01 09:37:05 +02:00
parent 3320ee8e05
commit 9aa50104db
5 changed files with 45 additions and 45 deletions

View file

@ -104,7 +104,7 @@ void handle_event_property_notify(XEvent *e)
// Change name of desktops
else if (at == server.atom._NET_DESKTOP_NAMES) {
if (debug)
fprintf(stderr, "tint2: %s %d: win = root, atom = _NET_DESKTOP_NAMES\n", __FUNCTION__, __LINE__);
fprintf(stderr, "tint2: %s %d: win = root, atom = _NET_DESKTOP_NAMES\n", __func__, __LINE__);
update_desktop_names();
}
// Change desktops
@ -112,7 +112,7 @@ void handle_event_property_notify(XEvent *e)
at == server.atom._NET_DESKTOP_VIEWPORT || at == server.atom._NET_WORKAREA ||
at == server.atom._NET_CURRENT_DESKTOP) {
if (debug)
fprintf(stderr, "tint2: %s %d: win = root, atom = ?? desktops changed\n", __FUNCTION__, __LINE__);
fprintf(stderr, "tint2: %s %d: win = root, atom = ?? desktops changed\n", __func__, __LINE__);
if (!taskbar_enabled)
return;
int old_num_desktops = server.num_desktops;
@ -202,7 +202,7 @@ void handle_event_property_notify(XEvent *e)
// Window list
else if (at == server.atom._NET_CLIENT_LIST) {
if (debug)
fprintf(stderr, "tint2: %s %d: win = root, atom = _NET_CLIENT_LIST\n", __FUNCTION__, __LINE__);
fprintf(stderr, "tint2: %s %d: win = root, atom = _NET_CLIENT_LIST\n", __func__, __LINE__);
taskbar_refresh_tasklist();
update_all_taskbars_visibility();
schedule_panel_redraw();
@ -210,12 +210,12 @@ void handle_event_property_notify(XEvent *e)
// Change active
else if (at == server.atom._NET_ACTIVE_WINDOW) {
if (debug)
fprintf(stderr, "tint2: %s %d: win = root, atom = _NET_ACTIVE_WINDOW\n", __FUNCTION__, __LINE__);
fprintf(stderr, "tint2: %s %d: win = root, atom = _NET_ACTIVE_WINDOW\n", __func__, __LINE__);
reset_active_task();
schedule_panel_redraw();
} else if (at == server.atom._XROOTPMAP_ID || at == server.atom._XROOTMAP_ID) {
if (debug)
fprintf(stderr, "tint2: %s %d: win = root, atom = _XROOTPMAP_ID\n", __FUNCTION__, __LINE__);
fprintf(stderr, "tint2: %s %d: win = root, atom = _XROOTPMAP_ID\n", __func__, __LINE__);
// change Wallpaper
for (int i = 0; i < num_panels; i++) {
set_panel_background(&panels[i]);
@ -234,7 +234,7 @@ void handle_event_property_notify(XEvent *e)
char *atom_name = XGetAtomName(server.display, at);
fprintf(stderr,
"%s %d: win = %ld, task = %s, atom = %s\n",
__FUNCTION__,
__func__,
__LINE__,
win,
task ? (task->title ? task->title : "??") : "null",
@ -243,7 +243,7 @@ void handle_event_property_notify(XEvent *e)
}
if (!task) {
if (debug)
fprintf(stderr, "tint2: %s %d\n", __FUNCTION__, __LINE__);
fprintf(stderr, "tint2: %s %d\n", __func__, __LINE__);
if (at == server.atom._NET_WM_STATE) {
// xfce4 sends _NET_WM_STATE after minimized to tray, so we need to check if window is mapped
// if it is mapped and not set as skip_taskbar, we must add it to our task list
@ -277,7 +277,7 @@ void handle_event_property_notify(XEvent *e)
Atom *atom_state = server_get_property(win, server.atom._NET_WM_STATE, XA_ATOM, &count);
for (int j = 0; j < count; j++) {
char *atom_state_name = XGetAtomName(server.display, atom_state[j]);
fprintf(stderr, "tint2: %s %d: _NET_WM_STATE = %s\n", __FUNCTION__, __LINE__, atom_state_name);
fprintf(stderr, "tint2: %s %d: _NET_WM_STATE = %s\n", __func__, __LINE__, atom_state_name);
XFree(atom_state_name);
}
XFree(atom_state);

View file

@ -165,7 +165,7 @@ gboolean resize_panel(void *obj);
void render_panel(Panel *panel);
void shrink_panel(Panel *panel);
void _schedule_panel_redraw(const char *file, const char *function, const int line);
#define schedule_panel_redraw() _schedule_panel_redraw(__FILE__, __FUNCTION__, __LINE__)
#define schedule_panel_redraw() _schedule_panel_redraw(__FILE__, __func__, __LINE__)
void set_panel_items_order(Panel *p);
void place_panel_all_desktops(Panel *p);

View file

@ -184,7 +184,7 @@ int systray_compute_desired_size(void *obj)
gboolean resize_systray(void *obj)
{
if (systray_profile)
fprintf(stderr, "tint2: [%f] %s:%d\n", profiling_get_time(), __FUNCTION__, __LINE__);
fprintf(stderr, "tint2: [%f] %s:%d\n", profiling_get_time(), __func__, __LINE__);
int size;
systray_compute_geometry(&size);
@ -227,7 +227,7 @@ gboolean resize_systray(void *obj)
void draw_systray(void *obj, cairo_t *c)
{
if (systray_profile)
fprintf(stderr, BLUE "tint2: [%f] %s:%d" RESET "\n", profiling_get_time(), __FUNCTION__, __LINE__);
fprintf(stderr, BLUE "tint2: [%f] %s:%d" RESET "\n", profiling_get_time(), __func__, __LINE__);
if (systray_composited) {
if (render_background)
XFreePixmap(server.display, render_background);
@ -271,7 +271,7 @@ void systray_dump_geometry(void *obj, int indent)
void on_change_systray(void *obj)
{
if (systray_profile)
fprintf(stderr, "tint2: [%f] %s:%d\n", profiling_get_time(), __FUNCTION__, __LINE__);
fprintf(stderr, "tint2: [%f] %s:%d\n", profiling_get_time(), __func__, __LINE__);
if (systray.icons_per_column == 0 || systray.icons_per_row == 0)
return;
@ -301,7 +301,7 @@ void on_change_systray(void *obj)
if (systray_profile)
fprintf(stderr,
"%s:%d win = %lu (%s), parent = %lu, x = %d, y = %d\n",
__FUNCTION__,
__func__,
__LINE__,
traywin->win,
traywin->name,
@ -358,7 +358,7 @@ void on_change_systray(void *obj)
void start_net()
{
if (systray_profile)
fprintf(stderr, "tint2: [%f] %s:%d\n", profiling_get_time(), __FUNCTION__, __LINE__);
fprintf(stderr, "tint2: [%f] %s:%d\n", profiling_get_time(), __func__, __LINE__);
if (net_sel_win) {
// protocol already started
if (!systray_enabled)
@ -464,7 +464,7 @@ void start_net()
fprintf(stderr, GREEN "tint2: systray started" RESET "\n");
if (systray_profile)
fprintf(stderr, "tint2: [%f] %s:%d\n", profiling_get_time(), __FUNCTION__, __LINE__);
fprintf(stderr, "tint2: [%f] %s:%d\n", profiling_get_time(), __func__, __LINE__);
XClientMessageEvent ev;
ev.type = ClientMessage;
ev.window = server.root_win;
@ -481,7 +481,7 @@ void start_net()
void handle_systray_event(XClientMessageEvent *e)
{
if (systray_profile)
fprintf(stderr, "tint2: [%f] %s:%d\n", profiling_get_time(), __FUNCTION__, __LINE__);
fprintf(stderr, "tint2: [%f] %s:%d\n", profiling_get_time(), __func__, __LINE__);
Window win;
unsigned long opcode = e->data.l[1];
@ -509,7 +509,7 @@ void handle_systray_event(XClientMessageEvent *e)
void stop_net()
{
if (systray_profile)
fprintf(stderr, "tint2: [%f] %s:%d\n", profiling_get_time(), __FUNCTION__, __LINE__);
fprintf(stderr, "tint2: [%f] %s:%d\n", profiling_get_time(), __func__, __LINE__);
if (systray.list_icons) {
// remove_icon change systray.list_icons
while (systray.list_icons)
@ -529,7 +529,7 @@ gboolean error;
int window_error_handler(Display *d, XErrorEvent *e)
{
if (systray_profile)
fprintf(stderr, RED "tint2: [%f] %s:%d" RESET "\n", profiling_get_time(), __FUNCTION__, __LINE__);
fprintf(stderr, RED "tint2: [%f] %s:%d" RESET "\n", profiling_get_time(), __func__, __LINE__);
error = TRUE;
if (e->error_code != BadWindow) {
fprintf(stderr, RED "tint2: systray: error code %d" RESET "\n", e->error_code);
@ -623,7 +623,7 @@ gboolean add_icon(Window win)
char *name = get_window_name(win);
if (systray_profile)
fprintf(stderr, "tint2: [%f] %s:%d win = %lu (%s)\n", profiling_get_time(), __FUNCTION__, __LINE__, win, name);
fprintf(stderr, "tint2: [%f] %s:%d win = %lu (%s)\n", profiling_get_time(), __func__, __LINE__, win, name);
Panel *panel = systray.area.panel;
// Get the process ID of the application that created the window
@ -748,14 +748,14 @@ gboolean add_icon(Window win)
}
if (systray_profile)
fprintf(stderr, "tint2: [%f] %s:%d\n", profiling_get_time(), __FUNCTION__, __LINE__);
fprintf(stderr, "tint2: [%f] %s:%d\n", profiling_get_time(), __func__, __LINE__);
// Resize and redraw the systray
if (systray_profile)
fprintf(stderr,
BLUE "[%f] %s:%d trigger resize & redraw" RESET "\n",
profiling_get_time(),
__FUNCTION__,
__func__,
__LINE__);
systray.area.resize_needed = TRUE;
panel->area.resize_needed = TRUE;
@ -770,7 +770,7 @@ gboolean reparent_icon(TrayWindow *traywin)
fprintf(stderr,
"[%f] %s:%d win = %lu (%s)\n",
profiling_get_time(),
__FUNCTION__,
__func__,
__LINE__,
traywin->win,
traywin->name);
@ -832,7 +832,7 @@ gboolean reparent_icon(TrayWindow *traywin)
fprintf(stderr,
"[%f] %s:%d win = %lu (%s)\n",
profiling_get_time(),
__FUNCTION__,
__func__,
__LINE__,
traywin->win,
traywin->name);
@ -846,7 +846,7 @@ gboolean embed_icon(TrayWindow *traywin)
fprintf(stderr,
"[%f] %s:%d win = %lu (%s)\n",
profiling_get_time(),
__FUNCTION__,
__func__,
__LINE__,
traywin->win,
traywin->name);
@ -903,7 +903,7 @@ gboolean embed_icon(TrayWindow *traywin)
fprintf(stderr,
"[%f] %s:%d win = %lu (%s)\n",
profiling_get_time(),
__FUNCTION__,
__func__,
__LINE__,
traywin->win,
traywin->name);
@ -917,7 +917,7 @@ void remove_icon(TrayWindow *traywin)
fprintf(stderr,
"[%f] %s:%d win = %lu (%s)\n",
profiling_get_time(),
__FUNCTION__,
__func__,
__LINE__,
traywin->win,
traywin->name);
@ -963,7 +963,7 @@ void remove_icon(TrayWindow *traywin)
fprintf(stderr,
BLUE "[%f] %s:%d trigger resize & redraw" RESET "\n",
profiling_get_time(),
__FUNCTION__,
__func__,
__LINE__);
systray.area.resize_needed = TRUE;
panel->area.resize_needed = TRUE;
@ -1086,7 +1086,7 @@ void systray_reconfigure_event(TrayWindow *traywin, XEvent *e)
fprintf(stderr,
BLUE "[%f] %s:%d trigger resize & redraw" RESET "\n",
profiling_get_time(),
__FUNCTION__,
__func__,
__LINE__);
schedule_panel_redraw();
refresh_systray = TRUE;
@ -1165,7 +1165,7 @@ void systray_resize_request_event(TrayWindow *traywin, XEvent *e)
fprintf(stderr,
BLUE "[%f] %s:%d trigger resize & redraw" RESET "\n",
profiling_get_time(),
__FUNCTION__,
__func__,
__LINE__);
schedule_panel_redraw();
refresh_systray = TRUE;
@ -1177,7 +1177,7 @@ void systray_destroy_event(TrayWindow *traywin)
fprintf(stderr,
"[%f] %s:%d win = %lu (%s)\n",
profiling_get_time(),
__FUNCTION__,
__func__,
__LINE__,
traywin->win,
traywin->name);
@ -1212,7 +1212,7 @@ void systray_render_icon_composited(void *t)
fprintf(stderr,
"[%f] %s:%d win = %lu (%s)\n",
profiling_get_time(),
__FUNCTION__,
__func__,
__LINE__,
traywin->win,
traywin->name);
@ -1230,7 +1230,7 @@ void systray_render_icon_composited(void *t)
fprintf(stderr,
YELLOW "[%f] %s:%d win = %lu (%s) delaying rendering" RESET "\n",
profiling_get_time(),
__FUNCTION__,
__func__,
__LINE__,
traywin->win,
traywin->name);
@ -1250,7 +1250,7 @@ void systray_render_icon_composited(void *t)
fprintf(stderr,
YELLOW "[%f] %s:%d win = %lu (%s) delaying rendering" RESET "\n",
profiling_get_time(),
__FUNCTION__,
__func__,
__LINE__,
traywin->win,
traywin->name);
@ -1381,7 +1381,7 @@ void systray_render_icon_composited(void *t)
fprintf(stderr,
"[%f] %s:%d win = %lu (%s)\n",
profiling_get_time(),
__FUNCTION__,
__func__,
__LINE__,
traywin->win,
traywin->name);
@ -1419,7 +1419,7 @@ void systray_render_icon(void *t)
// fprintf(stderr,
// YELLOW "[%f] %s:%d win = %lu (%s) delaying rendering" RESET "\n",
// profiling_get_time(),
// __FUNCTION__,
// __func__,
// __LINE__,
// traywin->win,
// traywin->name);
@ -1433,7 +1433,7 @@ void systray_render_icon(void *t)
fprintf(stderr,
"[%f] %s:%d win = %lu (%s)\n",
profiling_get_time(),
__FUNCTION__,
__func__,
__LINE__,
traywin->win,
traywin->name);
@ -1466,7 +1466,7 @@ void systray_render_icon(void *t)
fprintf(stderr,
YELLOW "[%f] %s:%d win = %lu (%s) delaying rendering" RESET "\n",
profiling_get_time(),
__FUNCTION__,
__func__,
__LINE__,
traywin->win,
traywin->name);
@ -1500,7 +1500,7 @@ void systray_render_icon(void *t)
void refresh_systray_icons()
{
if (systray_profile)
fprintf(stderr, BLUE "tint2: [%f] %s:%d" RESET "\n", profiling_get_time(), __FUNCTION__, __LINE__);
fprintf(stderr, BLUE "tint2: [%f] %s:%d" RESET "\n", profiling_get_time(), __func__, __LINE__);
TrayWindow *traywin;
GSList *l;
for (l = systray.list_icons; l; l = l->next) {

View file

@ -93,7 +93,7 @@ Task *add_task(Window win)
(int)win,
task_template.title ? task_template.title : "null");
// fprintf(stderr, "tint2: %s %d: win = %ld, task = %s\n", __FUNCTION__, __LINE__, win, task_template.title ?
// fprintf(stderr, "tint2: %s %d: win = %ld, task = %s\n", __func__, __LINE__, win, task_template.title ?
// task_template.title : "??");
// fprintf(stderr, "tint2: new task %s win %u: desktop %d, monitor %d\n", new_task.title, win, new_task.desktop, monitor);
@ -118,7 +118,7 @@ Task *add_task(Window win)
task_instance->win_h = task_template.win_h;
task_instance->current_state = TASK_UNDEFINED; // to update the current state later in set_task_state...
if (task_instance->desktop == ALL_DESKTOPS && server.desktop != j) {
// fprintf(stderr, "tint2: %s %d: win = %ld hiding task: another desktop\n", __FUNCTION__, __LINE__, win);
// fprintf(stderr, "tint2: %s %d: win = %ld hiding task: another desktop\n", __func__, __LINE__, win);
task_instance->area.on_screen = always_show_all_desktop_tasks;
}
task_instance->title = task_template.title;
@ -186,7 +186,7 @@ void remove_task(Task *task)
if (!task)
return;
// fprintf(stderr, "tint2: %s %d: win = %ld, task = %s\n", __FUNCTION__, __LINE__, task->win, task->title ? task->title :
// fprintf(stderr, "tint2: %s %d: win = %ld, task = %s\n", __func__, __LINE__, task->win, task->title ? task->title :
// "??");
if (taskbar_mode == MULTI_DESKTOP) {
@ -292,7 +292,7 @@ void task_update_icon(Task *task)
if (0 && img)
fprintf(stderr,
"%s: Got %dx%d icon via _NET_WM_ICON for %s\n",
__FUNCTION__,
__func__,
w,
h,
task->title ? task->title : "task");
@ -318,7 +318,7 @@ void task_update_icon(Task *task)
if (0 && img)
fprintf(stderr,
"%s: Got %dx%d pixmap icon via WM_HINTS for %s\n",
__FUNCTION__,
__func__,
w,
h,
task->title ? task->title : "task");
@ -783,7 +783,7 @@ void task_handle_mouse_event(Task *task, MouseAction action)
void task_update_desktop(Task *task)
{
// fprintf(stderr, "tint2: %s %d:\n", __FUNCTION__, __LINE__);
// fprintf(stderr, "tint2: %s %d:\n", __func__, __LINE__);
Window win = task->win;
remove_task(task);
task = add_task(win);

View file

@ -467,7 +467,7 @@ void taskbar_refresh_tasklist()
{
if (!taskbar_enabled)
return;
// fprintf(stderr, "tint2: %s %d:\n", __FUNCTION__, __LINE__);
// fprintf(stderr, "tint2: %s %d:\n", __func__, __LINE__);
int num_results;
Window *win = server_get_property(server.root_win, server.atom._NET_CLIENT_LIST, XA_WINDOW, &num_results);