UtkarshVerma / dwmblocks-async

An efficient, lean, and asynchronous status feed generator for dwm.
GNU General Public License v2.0
232 stars 87 forks source link

Problem with commenting lines in config.h #62

Closed Zerogaku closed 7 months ago

Zerogaku commented 7 months ago

Most likely having to do with the rewrite but I can't figure out a way to comment out lines in the blocks section of the config.h without failing to build:

I used to do commenting like this:

Block blocks[] = {
    {"cat /tmp/recordingicon 2>/dev/null",  0,  1},
    {"sb-music",   18000,    2 },
    {"sb-kbselect",    1800, 3 },
    /*{"sb-disk",    1800, 3 },*/
    /*{"sb-memory",  10,   4 },*/
    {"sb-news", 0,    5 },
    /*{"sb-forecast",     18000,    6 },*/
    /*{"sb-nettraf",  1,    7 },*/
    {"sb-volume",  18000,    8 },
    {"sb-battery", 5,    9 },
    {"sb-clock",    1,    10},
    {"sb-internet",    1,    11},
    /*{"sb-help-icon",    0,    12},*/
};

but now this no longer works:

#define BLOCKS(X)         \
    X("cat /tmp/recordingicon 2>/dev/null", 0, 1) \
    X("sb-music", 18000, 2)                       \
    X("sb-kbselect", 1800, 3)                     \
    /*X("sb-disk",    1800, 3)                    \*/
    /*X("sb-memory",  10,   4)                    \*/
    X("sb-news", 0, 5)                            \
    /*X("sb-forecast", 18000, 6)                  \*/
    /*X("sb-nettraf",  1,    7)                   \*/
    X("sb-volume", 18000, 8)                      \
    X("sb-battery", 5, 9)                         \
    X("sb-clock", 1, 10)                          \
    X("sb-internet", 1, 11)                       \
    /*X("sb-help-icon", 0, 12)                    \*/

neither does this:

#define BLOCKS(X)         \
    X("cat /tmp/recordingicon 2>/dev/null", 0, 1) \
    X("sb-music", 18000, 2)                       \
    X("sb-kbselect", 1800, 3)                     \
    //X("sb-disk",    1800, 3)
    //X("sb-memory",  10,   4)
    X("sb-news", 0, 5)                            \
    //X("sb-forecast", 18000, 6)
    //X("sb-nettraf",  1,    7)
    X("sb-volume", 18000, 8)                      \
    X("sb-battery", 5, 9)                         \
    X("sb-clock", 1, 10)                          \
    X("sb-internet", 1, 11)
    //X("sb-help-icon", 0, 12)

the make install will just error with this:

CLEAN    build
CC       build/block.o
In file included from include/block.h:8,
                 from src/block.c:1:
./config.h:26:7: error: expected declaration specifiers or ‘...’ before string constant
   26 |     X("sb-news", 0, 5)                            \
      |       ^~~~~~~~~
./config.h:26:18: error: expected declaration specifiers or ‘...’ before numeric constant
   26 |     X("sb-news", 0, 5)                            \
      |                  ^
./config.h:26:21: error: expected declaration specifiers or ‘...’ before numeric constant
   26 |     X("sb-news", 0, 5)                            \
      |                     ^
make: *** [Makefile:34: build/block.o] Error 1
UtkarshVerma commented 7 months ago

Please look into the syntax for multi-line macros in C.