From owner-svn-src-all@FreeBSD.ORG Fri Jun 14 11:16:52 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id C0D9B5F7; Fri, 14 Jun 2013 11:16:52 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 98D441365; Fri, 14 Jun 2013 11:16:52 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5EAjWI7076383; Fri, 14 Jun 2013 10:45:32 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5EAjV2T076381; Fri, 14 Jun 2013 10:45:31 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201306141045.r5EAjV2T076381@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Fri, 14 Jun 2013 10:45:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r251746 - in stable/8/contrib/gcclibs/libcpp: . include X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Jun 2013 11:16:52 -0000 Author: pfg Date: Fri Jun 14 10:45:31 2013 New Revision: 251746 URL: http://svnweb.freebsd.org/changeset/base/251746 Log: MFC r250550: (Missing libcpp merge) Add support for "d" floating-point suffix, as defined by draft N1312 of TR 24732. Reported by: dim Pointy hat: pfg Modified: stable/8/contrib/gcclibs/libcpp/expr.c stable/8/contrib/gcclibs/libcpp/include/cpplib.h Directory Properties: stable/8/contrib/gcclibs/ (props changed) Modified: stable/8/contrib/gcclibs/libcpp/expr.c ============================================================================== --- stable/8/contrib/gcclibs/libcpp/expr.c Fri Jun 14 10:26:38 2013 (r251745) +++ stable/8/contrib/gcclibs/libcpp/expr.c Fri Jun 14 10:45:31 2013 (r251746) @@ -82,7 +82,7 @@ static void check_promotion (cpp_reader static unsigned int interpret_float_suffix (const uchar *s, size_t len) { - size_t f = 0, l = 0, i = 0, d = 0; + size_t f = 0, l = 0, i = 0, d = 0, d0 = 0; while (len--) switch (s[len]) @@ -101,7 +101,12 @@ interpret_float_suffix (const uchar *s, return 0; } - if (f + l > 1 || i > 1) + if (d == 1 && !f && !l) { + d = 0; + d0 = 1; + } + + if (f + d0 + l > 1 || i > 1) return 0; /* Allow dd, df, dl suffixes for decimal float constants. */ @@ -110,7 +115,8 @@ interpret_float_suffix (const uchar *s, return ((i ? CPP_N_IMAGINARY : 0) | (f ? CPP_N_SMALL : - l ? CPP_N_LARGE : CPP_N_MEDIUM) + d0 ? CPP_N_MEDIUM : + l ? CPP_N_LARGE : CPP_N_DEFAULT) | (d ? CPP_N_DFLOAT : 0)); } @@ -261,6 +267,13 @@ cpp_classify_number (cpp_reader *pfile, "traditional C rejects the \"%.*s\" suffix", (int) (limit - str), str); + /* A suffix for double is a GCC extension via decimal float support. + If the suffix also specifies an imaginary value we'll catch that + later. */ + if ((result == CPP_N_MEDIUM) && CPP_PEDANTIC (pfile)) + cpp_error (pfile, CPP_DL_PEDWARN, + "suffix for double constant is a GCC extension"); + /* Radix must be 10 for decimal floats. */ if ((result & CPP_N_DFLOAT) && radix != 10) { Modified: stable/8/contrib/gcclibs/libcpp/include/cpplib.h ============================================================================== --- stable/8/contrib/gcclibs/libcpp/include/cpplib.h Fri Jun 14 10:26:38 2013 (r251745) +++ stable/8/contrib/gcclibs/libcpp/include/cpplib.h Fri Jun 14 10:45:31 2013 (r251746) @@ -748,6 +748,7 @@ struct cpp_num #define CPP_N_UNSIGNED 0x1000 /* Properties. */ #define CPP_N_IMAGINARY 0x2000 #define CPP_N_DFLOAT 0x4000 +#define CPP_N_DEFAULT 0x8000 /* Classify a CPP_NUMBER token. The return value is a combination of the flags from the above sets. */