尝试构建 FVWM95 的预处理器错误

Preprocessor errors trying to build FVWM95

尝试构建 fvwm95-2.0.43f 时出现以下错误:

FvwmIconBox.c: In function 'myErrorHandler':
FvwmIconMan.c:412:1: error: pasting "." and "res" does not give a valid preprocessing token

OS 是 Debian,尝试过 Wheezy 和 Jessie。我最好的猜测是,这可能只是自 FVWM95 发布以来 gcc 处理预处理器语法的方式的微小变化,但不确定。

在此处获取源代码: http://sourceforge.net/projects/fvwm95/files/fvwm95/

谢谢!!

嗯,粘贴实际行和预处理器宏可能会有用,因为我们都喜欢下载过去 12.5 年来未见变化的 tgz:

#define SET_MANAGER(manager,field,value)                           \
   do {                                                            \
     int id = manager;                                             \
     if (id == -1) {                                               \
       for (id = 0; id < globals.num_managers; id++) {             \
     globals.managers[id].##field = value;                     \
       }                                                           \
     }                                                             \
     else if (id < globals.num_managers) {                         \
       globals.managers[id].##field = value;                       \
     }                                                             \
     else {                                                        \
       ConsoleMessage ("Internal error in SET_MANAGER: %d\n", id); \
     }                                                             \
   } while (0)

大号。 412:

SET_MANAGER (manager, res, r);

你是对的:这是一个 "minor change" 突然发生在十年的最后一个八分之一;):

来自 https://gcc.gnu.org/onlinedocs/cpp/Concatenation.html :

However, two tokens that don't together form a valid token cannot be pasted together. For example, you cannot concatenate x with + in either order. If you try, the preprocessor issues a warning and emits the two tokens. Whether it puts white space between the tokens is undefined. It is common to find unnecessary uses of ‘##’ in complex macros. If you get this warning, it is likely that you can simply remove the ‘##’.