All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] libdecnumber: Fix warnings from smatch (missing static, boolean operations)
@ 2014-08-20  9:02 Stefan Weil
  2014-08-24  9:21 ` [Qemu-devel] [Qemu-trivial] " Michael Tokarev
  0 siblings, 1 reply; 5+ messages in thread
From: Stefan Weil @ 2014-08-20  9:02 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-trivial, Stefan Weil

Signed-off-by: Stefan Weil <sw@weilnetz.de>
---
 libdecnumber/decNumber.c |   21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/libdecnumber/decNumber.c b/libdecnumber/decNumber.c
index a30632f..58211e7 100644
--- a/libdecnumber/decNumber.c
+++ b/libdecnumber/decNumber.c
@@ -5275,8 +5275,8 @@ static decNumber * decMultiplyOp(decNumber *res, const decNumber *lhs,
 /* 4. The working precisions for the static buffers are twice the     */
 /*    obvious size to allow for calls from decNumberPower.	      */
 /* ------------------------------------------------------------------ */
-decNumber * decExpOp(decNumber *res, const decNumber *rhs,
-			 decContext *set, uInt *status) {
+static decNumber *decExpOp(decNumber *res, const decNumber *rhs,
+                           decContext *set, uInt *status) {
   uInt ignore=0;		   /* working status */
   Int h;			   /* adjusted exponent for 0.xxxx */
   Int p;			   /* working precision */
@@ -5563,7 +5563,8 @@ decNumber * decExpOp(decNumber *res, const decNumber *rhs,
 /*	     where x is truncated (NB) into the range 10 through 99,  */
 /*	     and then c = k>>2 and e = k&3.			      */
 /* ------------------------------------------------------------------ */
-const uShort LNnn[90]={9016,  8652,  8316,  8008,  7724,  7456,	 7208,
+static const uShort LNnn[90] = {
+  9016,  8652,  8316,  8008,  7724,  7456,  7208,
   6972,	 6748,	6540,  6340,  6148,  5968,  5792,  5628,  5464,	 5312,
   5164,	 5020,	4884,  4748,  4620,  4496,  4376,  4256,  4144,	 4032,
  39233, 38181, 37157, 36157, 35181, 34229, 33297, 32389, 31501, 30629,
@@ -5635,8 +5636,8 @@ const uShort LNnn[90]={9016,  8652,  8316,  8008,  7724,  7456,	 7208,
 /* 5. The static buffers are larger than might be expected to allow   */
 /*    for calls from decNumberPower.				      */
 /* ------------------------------------------------------------------ */
-decNumber * decLnOp(decNumber *res, const decNumber *rhs,
-		    decContext *set, uInt *status) {
+static decNumber *decLnOp(decNumber *res, const decNumber *rhs,
+                          decContext *set, uInt *status) {
   uInt ignore=0;		   /* working status accumulator */
   uInt needbytes;		   /* for space calculations */
   Int residue;			   /* rounding residue */
@@ -6052,9 +6053,9 @@ static decNumber * decQuantizeOp(decNumber *res, const decNumber *lhs,
 /* The emphasis here is on speed for common cases, and avoiding	      */
 /* coefficient comparison if possible.				      */
 /* ------------------------------------------------------------------ */
-decNumber * decCompareOp(decNumber *res, const decNumber *lhs,
-			 const decNumber *rhs, decContext *set,
-			 Flag op, uInt *status) {
+static decNumber *decCompareOp(decNumber *res, const decNumber *lhs,
+                               const decNumber *rhs, decContext *set,
+                               Flag op, uInt *status) {
   #if DECSUBSET
   decNumber *alloclhs=NULL;	   /* non-NULL if rounded lhs allocated */
   decNumber *allocrhs=NULL;	   /* .., rhs */
@@ -6086,11 +6087,11 @@ decNumber * decCompareOp(decNumber *res, const decNumber *lhs,
 
     /* If total ordering then handle differing signs 'up front' */
     if (op==COMPTOTAL) {		/* total ordering */
-      if (decNumberIsNegative(lhs) & !decNumberIsNegative(rhs)) {
+      if (decNumberIsNegative(lhs) && !decNumberIsNegative(rhs)) {
 	result=-1;
 	break;
 	}
-      if (!decNumberIsNegative(lhs) & decNumberIsNegative(rhs)) {
+      if (!decNumberIsNegative(lhs) && decNumberIsNegative(rhs)) {
 	result=+1;
 	break;
 	}
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [Qemu-trivial] [PATCH] libdecnumber: Fix warnings from smatch (missing static, boolean operations)
  2014-08-20  9:02 [Qemu-devel] [PATCH] libdecnumber: Fix warnings from smatch (missing static, boolean operations) Stefan Weil
@ 2014-08-24  9:21 ` Michael Tokarev
  2014-08-24  9:42   ` Stefan Weil
  0 siblings, 1 reply; 5+ messages in thread
From: Michael Tokarev @ 2014-08-24  9:21 UTC (permalink / raw)
  To: Stefan Weil, qemu-devel; +Cc: qemu-trivial

Applied to -trivial, thank you!

But I've a small concern - should we really do this on "external" sources,
and divirge from upstream needlessly?

Thanks,

/mjt

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [Qemu-trivial] [PATCH] libdecnumber: Fix warnings from smatch (missing static, boolean operations)
  2014-08-24  9:21 ` [Qemu-devel] [Qemu-trivial] " Michael Tokarev
@ 2014-08-24  9:42   ` Stefan Weil
  2014-08-25  7:40     ` Markus Armbruster
  2014-08-25 13:49     ` Tom Musta
  0 siblings, 2 replies; 5+ messages in thread
From: Stefan Weil @ 2014-08-24  9:42 UTC (permalink / raw)
  To: Michael Tokarev, qemu-devel; +Cc: qemu-trivial

Am 24.08.2014 11:21, schrieb Michael Tokarev:
> Applied to -trivial, thank you!
>
> But I've a small concern - should we really do this on "external" sources,
> and divirge from upstream needlessly?
>
> Thanks,
>
> /mjt

In general, I agree. In this case, the code was part of gcc, and newer 
versions of gcc use GPL 3 which is incompatible with QEMU, so I assume 
that the code in QEMU is no longer available from a maintained upstream.

Stefan

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [Qemu-trivial] [PATCH] libdecnumber: Fix warnings from smatch (missing static, boolean operations)
  2014-08-24  9:42   ` Stefan Weil
@ 2014-08-25  7:40     ` Markus Armbruster
  2014-08-25 13:49     ` Tom Musta
  1 sibling, 0 replies; 5+ messages in thread
From: Markus Armbruster @ 2014-08-25  7:40 UTC (permalink / raw)
  To: Stefan Weil; +Cc: qemu-trivial, Michael Tokarev, qemu-devel

Stefan Weil <sw@weilnetz.de> writes:

> Am 24.08.2014 11:21, schrieb Michael Tokarev:
>> Applied to -trivial, thank you!
>>
>> But I've a small concern - should we really do this on "external" sources,
>> and divirge from upstream needlessly?
>>
>> Thanks,
>>
>> /mjt
>
> In general, I agree. In this case, the code was part of gcc, and newer
> versions of gcc use GPL 3 which is incompatible with QEMU, so I assume
> that the code in QEMU is no longer available from a maintained
> upstream.

Upstream switched to another license != upstream is no longer
maintained.

If you license your contribution under GPLv2+, both upstream and
downstream should be able to use it just fine.

Have you checked the current upstream code for presence of these issues?

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [Qemu-trivial] [PATCH] libdecnumber: Fix warnings from smatch (missing static, boolean operations)
  2014-08-24  9:42   ` Stefan Weil
  2014-08-25  7:40     ` Markus Armbruster
@ 2014-08-25 13:49     ` Tom Musta
  1 sibling, 0 replies; 5+ messages in thread
From: Tom Musta @ 2014-08-25 13:49 UTC (permalink / raw)
  To: Stefan Weil, Michael Tokarev, qemu-devel; +Cc: qemu-trivial, Alexander Graf

On 8/24/2014 4:42 AM, Stefan Weil wrote:
> Am 24.08.2014 11:21, schrieb Michael Tokarev:
>> Applied to -trivial, thank you!
>>
>> But I've a small concern - should we really do this on "external" sources,
>> and divirge from upstream needlessly?
>>
>> Thanks,
>>
>> /mjt
> 
> In general, I agree. In this case, the code was part of gcc, and newer versions of gcc use GPL 3 which is incompatible with QEMU, so I assume that the code in QEMU is no longer available from a maintained upstream.
> 
> Stefan
> 
> 
> 

Yes.  We had to effectively fork a copy the code to deal with the license issues.

FWIW ... Alex has suggested a reformat of the libdecnumber code to make it compatible with QEMU formatting (http://lists.nongnu.org/archive/html/qemu-ppc/2014-05/msg00085.html).  This is on my todo list.  Obviously, such a reformat would make it even
harder to synchronize with upstream gcc.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-08-25 13:49 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-20  9:02 [Qemu-devel] [PATCH] libdecnumber: Fix warnings from smatch (missing static, boolean operations) Stefan Weil
2014-08-24  9:21 ` [Qemu-devel] [Qemu-trivial] " Michael Tokarev
2014-08-24  9:42   ` Stefan Weil
2014-08-25  7:40     ` Markus Armbruster
2014-08-25 13:49     ` Tom Musta

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.