#ifdef with undeclared define leads to 'unterminated conditional directive'

1,488 views
Skip to first unread message

ckeh...@googlemail.com

unread,
Feb 28, 2018, 12:59:06 PM2/28/18
to ycm-users
My YCM configuration is working fine.

However, in one header file there is a "#ifdef' with a define that is, depending on the configuration, defined within the call to the compiler, see sample code below and attached. When it is defined, e.g. "-DDUSE_CK_PARSER", within the ".ycm_extra_conf.py" then everything is fine. I see no reason why clang should complain about when it is not defined.
Surprisingly, the errors shown below, are gone as soon as the line 'int i;' is activated (not as comment anymore).

Is this a bug? Which next steps do you suggest?

Best regards,
Claudius

#ifndef __CK_H_       // error: unterminated conditional directive
#define __CK_H_

// int i;

#ifdef USE_CK_PARSER 
// error: unterminated conditional directive

typedef enum
{
  CK_DATA_TYPE = 0,
  CK_DATA_TYPE_1 = 1
} CK_DATA_TYPE_t;

#endif /* USE_CK_PARSER */  // error: #endif without #if

#endif /* __CK_H_ */
            // error: #endif without #if
test.tar

mbo...@gmail.com

unread,
Mar 1, 2018, 7:06:36 AM3/1/18
to ycm-users
I can reproduce the issue with Clang 5.0.1. This seems to be fixed in version 6.0.0, which is going to be released soon (probably this week). If you don't want to wait, you can download the latest RC binaries for your platform, extract the archive, and run the install.py script as follows
:
EXTRA_CMAKE_ARGS="-DPATH_TO_LLVM_ROOT=/path/to/clang/6.0.0" ./install.py --clang-completer

where "/path/to/clang/6.0.0" is the path to the root folder extracted from the archive.

ckeh...@googlemail.com

unread,
Mar 9, 2018, 10:35:33 AM3/9/18
to ycm-users
Thanks a lot! That solved the issue!
Reply all
Reply to author
Forward
0 new messages