[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

[PATCH] fix potentially undefined operation warning

From: Andreas Stieger <andreas.stieger_at_gmx.de>
Date: Sat, 10 May 2014 13:26:50 +0100

Hello,

I found a compiler warning in trunk on a potentially undefined operation
when using an increment operator on a variable referenced in the same
expression. This is on gcc 4.3.4, does not happen in gcc 4.7 and up.
Treated as an error in some build configurations.

subversion/libsvn_fs_fs/id.c: In function 'txn_id_parse':
subversion/libsvn_fs_fs/id.c:98: warning: operation on 'data' may be
undefined

subversion/libsvn_fs_fs/transaction.c: In function 'read_next_ids':
subversion/libsvn_fs_fs/transaction.c:1300: warning: operation on 'str'
may be undefined

subversion/libsvn_fs_x/transaction.c: In function 'read_next_ids':
subversion/libsvn_fs_x/transaction.c:1354: warning: operation on 'str'
may be undefined

The attached patch fixes this, please review.

[[[
Fix warnings for potentially undefined operation.

Some code uses increment operators on variables referenced in the same
operation. See fsfs-improvements branch (r1517479,1506545) and
fsfs-format-7 (r1453765)

* subversion/libsvn_fs_fs/id.c
  (txn_id_parse): increment data pointer in a separate statement
* subversion/libsvn_fs_fs/transaction.c
  (read_next_ids): increment str pointer in a separate statement
* subversion/libsvn_fs_x/transaction.c
  (read_next_ids): same
]]]

With kind regards,
Andreas Stieger

Received on 2014-05-15 10:26:33 CEST

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.