From df863d33ab916c6d45697eb5fc5c1d5682a8e107 Mon Sep 17 00:00:00 2001 From: jakub Date: Tue, 31 Aug 2010 22:47:25 +0000 Subject: [PATCH 1/1] PR preprocessor/45457 * expr.c (parse_defined): Call pfile->cb.user_builtin_macro hook if needed. * directives.c (do_ifdef, do_ifndef): Likewise. * c-c++-common/cpp/pr45457.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@163705 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/c-c++-common/cpp/pr45457.c | 18 ++++++++++++++++++ libcpp/ChangeLog | 7 +++++++ libcpp/directives.c | 8 +++++++- libcpp/expr.c | 3 +++ 5 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/c-c++-common/cpp/pr45457.c diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 3f9a2eee032..d9f26d927f3 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2010-08-31 Jakub Jelinek + + PR preprocessor/45457 + * c-c++-common/cpp/pr45457.c: New test. + 2010-08-31 Eric Botcazou * gcc.dg/nested-func-8.c: New test. diff --git a/gcc/testsuite/c-c++-common/cpp/pr45457.c b/gcc/testsuite/c-c++-common/cpp/pr45457.c new file mode 100644 index 00000000000..14879cd7953 --- /dev/null +++ b/gcc/testsuite/c-c++-common/cpp/pr45457.c @@ -0,0 +1,18 @@ +/* PR preprocessor/45457 */ +/* { dg-do compile } */ + +const char *a = +#ifdef __DBL_DENORM_MIN__ +"a" +#endif +#if defined(__DBL_EPSILON__) +"b" +#endif +#ifndef __DBL_MAX__ +"c" +#endif +#if !defined(__DBL_MIN__) +"d" +#endif +; +double b = __DBL_DENORM_MIN__ + __DBL_EPSILON__ + __DBL_MAX__ + __DBL_MIN__; diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog index ab607fd89f5..5169a11558c 100644 --- a/libcpp/ChangeLog +++ b/libcpp/ChangeLog @@ -1,3 +1,10 @@ +2010-08-31 Jakub Jelinek + + PR preprocessor/45457 + * expr.c (parse_defined): Call pfile->cb.user_builtin_macro hook if + needed. + * directives.c (do_ifdef, do_ifndef): Likewise. + 2010-08-26 Rainer Orth * system.h [HAVE_INTTYPES_H]: Include inttypes.h. diff --git a/libcpp/directives.c b/libcpp/directives.c index 77da485cda1..997737bd4da 100644 --- a/libcpp/directives.c +++ b/libcpp/directives.c @@ -1,7 +1,7 @@ /* CPP Library. (Directive handling.) Copyright (C) 1986, 1987, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, - 2007, 2008, 2009 Free Software Foundation, Inc. + 2007, 2008, 2009, 2010 Free Software Foundation, Inc. Contributed by Per Bothner, 1994-95. Based on CCCP program by Paul Rubin, June 1986 Adapted to ANSI C, Richard Stallman, Jan 1987 @@ -1804,6 +1804,9 @@ do_ifdef (cpp_reader *pfile) node->flags |= NODE_USED; if (node->type == NT_MACRO) { + if ((node->flags & NODE_BUILTIN) + && pfile->cb.user_builtin_macro) + pfile->cb.user_builtin_macro (pfile, node); if (pfile->cb.used_define) pfile->cb.used_define (pfile, pfile->directive_line, node); } @@ -1842,6 +1845,9 @@ do_ifndef (cpp_reader *pfile) node->flags |= NODE_USED; if (node->type == NT_MACRO) { + if ((node->flags & NODE_BUILTIN) + && pfile->cb.user_builtin_macro) + pfile->cb.user_builtin_macro (pfile, node); if (pfile->cb.used_define) pfile->cb.used_define (pfile, pfile->directive_line, node); } diff --git a/libcpp/expr.c b/libcpp/expr.c index 4dbc98974af..d2f6c3cf0ac 100644 --- a/libcpp/expr.c +++ b/libcpp/expr.c @@ -700,6 +700,9 @@ parse_defined (cpp_reader *pfile) node->flags |= NODE_USED; if (node->type == NT_MACRO) { + if ((node->flags & NODE_BUILTIN) + && pfile->cb.user_builtin_macro) + pfile->cb.user_builtin_macro (pfile, node); if (pfile->cb.used_define) pfile->cb.used_define (pfile, pfile->directive_line, node); } -- 2.11.0