This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 235518 - A lot of misleading severe messages "INCORRECT #define directive" in the boost 1.54
Summary: A lot of misleading severe messages "INCORRECT #define directive" in the boos...
Status: RESOLVED FIXED
Alias: None
Product: cnd
Classification: Unclassified
Component: Code Model (show other bugs)
Version: 7.4
Hardware: All All
: P3 normal (vote)
Assignee: Vladimir Voskresensky
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-09-04 16:09 UTC by Alexander Simon
Modified: 2014-02-19 02:45 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Simon 2013-09-04 16:09:26 UTC
Message in console:

INCORRECT #define directive: in numeric_utils.hpp for:
	TOKEN{["#define ",<DEFINE>,line=53,col=1],offset=1965,file=null} MACRO{["BOOST_SPIRIT_LOG2",<ID>,line=53,col=9],offset=1973,file=null}BODY{["(",<LPAREN>,line=53,col=27],offset=1991,file=null ["#",<SHARP>,line=53,col=28],offset=1992,file=null ["error",<ID>,line=53,col=29],offset=1993,file=null}

File:
boost_1_54_0/boost/spirit/home/qi/numeric/detail/numeric_utils.hpp 

Macro definition:
--------------------------8<------------------------------
// lookup table for log2(x) : 2 <= x <= 36
#define BOOST_SPIRIT_LOG2 (#error)(#error)                                    \
(1000000)(1584960)(2000000)(2321920)(2584960)(2807350) \
(3000000)(3169920)(3321920)(3459430)(3584960)(3700430) \
(3807350)(3906890)(4000000)(4087460)(4169920)(4247920) \
(4321920)(4392310)(4459430)(4523560)(4584960)(4643850) \
(4700430)(4754880)(4807350)(4857980)(4906890)(4954190) \
(5000000)(5044390)(5087460)(5129280)(5169925) \
    /***/
--------------------------8<------------------------------
Comment 1 Alexander Simon 2013-09-04 16:12:12 UTC
Code is compiled and used in mata programming.

For example file:
boost_1_54_0/boost/preprocessor/iteration/detail/local.hpp
has template specialization:
BOOST_PP_LOCAL_MACRO(8)
that wrongly expanded to:
template <typename T> struct digits_traits<T, 23 > { typedef std::numeric_limits<T> numeric_limits_type; static const int value = static_cast < int > ( ( numeric_limits_type :: digits * 1000000 ) / BOOST_PP_SEQ_ELEM_23 BOOST_SPIRIT_LOG2 ) ; };
Comment 2 Alexander Simon 2013-09-04 16:40:45 UTC
I agree that depth 23 is too long.
Example with depth 2:

BOOST_PP_LOCAL_MACRO(2)

template <typename T> struct digits_traits<T, 2 > { typedef std::numeric_limits<T> numeric_limits_type; static const int value = static_cast < int > ( ( numeric_limits_type :: digits * 1000000 ) / BOOST_PP_SEQ_ELEM_2 BOOST_SPIRIT_LOG2 ) ; };
Comment 3 Vladimir Voskresensky 2014-02-13 12:13:48 UTC
what is the expected behavior? Print message once per problematic line?
Comment 4 Alexander Simon 2014-02-13 13:09:47 UTC
Extracted problem:
------------------------8<-----------------------
#define BOOST_SPIRIT_LOG2 (#error)(#error) (2) (3)
#define BOOST_PP_SEQ_ELEM(i, seq) BOOST_PP_SEQ_ELEM_I(i, seq)
#define BOOST_PP_SEQ_ELEM_I(i, seq) BOOST_PP_SEQ_ELEM_II(BOOST_PP_SEQ_ELEM_ ## i seq)
#define BOOST_PP_SEQ_ELEM_II(im) BOOST_PP_SEQ_ELEM_III(im)
#define BOOST_PP_SEQ_ELEM_III(x, _) x
#define BOOST_PP_NIL 
#define BOOST_PP_SEQ_ELEM_0(x) x, BOOST_PP_NIL
#define BOOST_PP_SEQ_ELEM_1(_) BOOST_PP_SEQ_ELEM_0
#define BOOST_PP_SEQ_ELEM_2(_) BOOST_PP_SEQ_ELEM_1
#define BOOST_PP_SEQ_ELEM_3(_) BOOST_PP_SEQ_ELEM_2

int main(int argc, char** argv) {
    int i = BOOST_PP_SEQ_ELEM(1, BOOST_SPIRIT_LOG2);
    return (i);
}
------------------------8<-----------------------
gcc    -c -g -MMD -MP -MF "build/Debug/GNU-Solaris-x86/main.o.d" -o build/Debug/GNU-Solaris-x86/main.o main.c
main.c: In function 'main':
main.c:16:5: error: stray '#' in program
main.c:16:13: error: 'error' undeclared (first use in this function)
main.c:16:13: note: each undeclared identifier is reported only once for each function it appears in
Comment 5 Vladimir Voskresensky 2014-02-14 17:00:39 UTC
http://hg.netbeans.org/cnd-main/rev/3661878ec3ea
Comment 6 Quality Engineering 2014-02-15 05:13:29 UTC
Integrated into 'main-silver', will be available in build *201402150001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/3661878ec3ea
User: Vladimir Voskresensky <vv159170@netbeans.org>
Log: fixed #235518 - A lot of misleading severe messages "INCORRECT #define directive" in the boost 1.54
- sharp with leading LPAREN is fine
Comment 7 Alexander Simon 2014-02-18 09:40:03 UTC
What about rest messages?
At least 3 places in apt module does not contain info about file.
Example of message:
SEVERE [org.netbeans.modules.cnd.apt]: include/sns.h, line 301: # is not followed by a macro parameter
Comment 8 Vladimir Voskresensky 2014-02-18 11:16:07 UTC
http://hg.netbeans.org/cnd-main/rev/e0019fe9d9be
Comment 9 Quality Engineering 2014-02-19 02:45:46 UTC
Integrated into 'main-silver', will be available in build *201402190001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/e0019fe9d9be
User: Vladimir Voskresensky <vv159170@netbeans.org>
Log: extra fix #235518 - A lot of misleading severe messages "INCORRECT #define directive" in the boost 1.54