[indent] Fix decimal float constant suffixes

Petr Pisar ppisar at fedoraproject.org
Thu Aug 25 09:55:30 UTC 2011


commit f71987d34bc942958bef17988af4de82467fd952
Author: Petr Písař <ppisar at redhat.com>
Date:   Thu Aug 25 11:44:56 2011 +0200

    Fix decimal float constant suffixes

 ...-split-decimal-float-suffix-from-constant.patch |   98 ++++++++++++++++++++
 indent.spec                                        |    9 ++-
 2 files changed, 106 insertions(+), 1 deletions(-)
---
diff --git a/indent-2.2.11-Do-not-split-decimal-float-suffix-from-constant.patch b/indent-2.2.11-Do-not-split-decimal-float-suffix-from-constant.patch
new file mode 100644
index 0000000..ea34d0e
--- /dev/null
+++ b/indent-2.2.11-Do-not-split-decimal-float-suffix-from-constant.patch
@@ -0,0 +1,98 @@
+From ff47ab3b90333bdfaa40b86cb548e92a01787345 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar at redhat.com>
+Date: Thu, 25 Aug 2011 11:26:24 +0200
+Subject: [PATCH] Do not split decimal float suffix from constant
+
+N1312 draft of ISO/IEC WDTR24732 defines additional floating types
+with given suffixes:
+
+_Decimal32  DF, df
+_Decimal64  DD, dd
+_Decimal128 DL, dl
+
+These suffixes must stick on numeric part of the constant as classic
+float or long float does.
+---
+ regression/TEST                             |    3 ++-
+ regression/input/float-constant-suffix.c    |   13 +++++++++++++
+ regression/standard/float-constant-suffix.c |   13 +++++++++++++
+ src/lexi.c                                  |    9 +++++++++
+ 4 files changed, 37 insertions(+), 1 deletions(-)
+ create mode 100644 regression/input/float-constant-suffix.c
+ create mode 100644 regression/standard/float-constant-suffix.c
+
+diff --git a/regression/TEST b/regression/TEST
+index c860ef2..1402ddf 100755
+--- a/regression/TEST
++++ b/regression/TEST
+@@ -35,7 +35,8 @@ EXAMPLES="do.c else.c for.c func-def.c lshift.c ncs.c \
+ 
+ BUGS="case-label.c one-line-1.c one-line-2.c one-line-3.c \
+         one-line-4.c struct-decl.c sizeof-in-while.c line-break-comment.c \
+-        macro.c enum.c elif.c nested.c wrapped-string.c minus_predecrement.c"
++        macro.c enum.c elif.c nested.c wrapped-string.c minus_predecrement.c \
++        float-constant-suffix.c"
+ 
+ INDENTSRC="args.c backup.h backup.c dirent_def.h globs.c indent.h \
+         indent.c indent_globs.h io.c lexi.c memcpy.c parse.c pr_comment.c \
+diff --git a/regression/input/float-constant-suffix.c b/regression/input/float-constant-suffix.c
+new file mode 100644
+index 0000000..58f5310
+--- /dev/null
++++ b/regression/input/float-constant-suffix.c
+@@ -0,0 +1,13 @@
++float foo = 1.0F;
++float foo = 1.0f;
++double foo = 1.0;
++double foo = 1.0;
++long double foo = 1.0L;
++long double foo = 1.0l;
++
++_Decimal32 foo = 1.0DF;
++_Decimal32 foo = 1.0df;
++_Decimal64 foo = 1.0DD;
++_Decimal64 foo = 1.0dd;
++_Decimal128 foo = 1.0DL;
++_Decimal128 foo = 1.0dl;
+diff --git a/regression/standard/float-constant-suffix.c b/regression/standard/float-constant-suffix.c
+new file mode 100644
+index 0000000..58f5310
+--- /dev/null
++++ b/regression/standard/float-constant-suffix.c
+@@ -0,0 +1,13 @@
++float foo = 1.0F;
++float foo = 1.0f;
++double foo = 1.0;
++double foo = 1.0;
++long double foo = 1.0L;
++long double foo = 1.0l;
++
++_Decimal32 foo = 1.0DF;
++_Decimal32 foo = 1.0df;
++_Decimal64 foo = 1.0DD;
++_Decimal64 foo = 1.0dd;
++_Decimal128 foo = 1.0DL;
++_Decimal128 foo = 1.0dl;
+diff --git a/src/lexi.c b/src/lexi.c
+index abc2bfa..eafb65e 100644
+--- a/src/lexi.c
++++ b/src/lexi.c
+@@ -330,6 +330,15 @@ extern codes_ty lexi(void)
+          {
+             buf_ptr++;
+          }
++         else if (*buf_ptr == 'D' || *buf_ptr == 'd')
++         {
++           if (buf_ptr[1] == 'F' || buf_ptr[1] == 'f' ||
++               buf_ptr[1] == 'D' || buf_ptr[1] == 'd' ||
++               buf_ptr[1] == 'L' || buf_ptr[1] == 'l')
++           {
++             buf_ptr+=2;
++           }
++         }
+          else
+          {
+             while (*buf_ptr == 'U' || *buf_ptr == 'u' || *buf_ptr == 'L' || *buf_ptr == 'l')
+-- 
+1.7.6
+
diff --git a/indent.spec b/indent.spec
index d628ba0..fa59ca4 100644
--- a/indent.spec
+++ b/indent.spec
@@ -2,13 +2,16 @@
 Summary: A GNU program for formatting C code
 Name: indent
 Version: 2.2.11
-Release: 3%{?dist}
+Release: 4%{?dist}
 License: GPLv3+
 Group: Applications/Text
 URL: http://indent.isidore-it.eu/beautify.html
 Source: http://indent.isidore-it.eu/%{name}-%{version}.tar.gz
 Patch5: indent-2.2.9-lcall.patch
 Patch7: indent-2.2.9-man.patch
+# Bug 733051, submitted to upstream
+# <https://lists.gnu.org/archive/html/bug-indent/2011-08/msg00000.html>
+Patch8: indent-2.2.11-Do-not-split-decimal-float-suffix-from-constant.patch
 BuildRequires: texinfo texi2html
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 Requires(post): /sbin/install-info
@@ -27,6 +30,7 @@ you want a program to format your code.
 %setup -q
 %patch5 -p1
 %patch7 -p1
+%patch8 -p1 -b .float_suffix
 
 %build
 %configure
@@ -65,6 +69,9 @@ fi
 
 
 %changelog
+* Thu Aug 25 2011 Petr Pisar <ppisar at redhat.com> - 2.2.11-4
+- Fix decimal float constant suffixes (bug #733051)
+
 * Wed Feb 09 2011 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 2.2.11-3
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
 


More information about the scm-commits mailing list