Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[bug #39087] Various format specifier problems cause build to fail

1 view
Skip to first unread message

Graham Lee

unread,
May 27, 2013, 4:21:06 PM5/27/13
to Graham Lee, bug-g...@gnu.org
URL:
<http://savannah.gnu.org/bugs/?39087>

Summary: Various format specifier problems cause build to
fail
Project: GNUstep
Submitted by: leeg
Submitted on: Mon 27 May 2013 08:21:05 PM GMT
Category: gsweb
Severity: 3 - Normal
Item Group: Bug
Status: None
Privacy: Public
Assigned to: None
Open/Closed: Open
Discussion Lock: Any

_______________________________________________________

Details:

I'm using clang (from Xcode 4.6.2), and building GSW on the Apple platform.
The build has -Werror specified, and many of the build errors that ensue are
due to format specifiers not matching the type being substituted.

There are other problems too, but I've fixed those in a separate patch because
there's something to discuss here. A lot of the format specifier problems
relate to use of NSUInteger in printf-style strings: the Apple clang build
doesn't like that because NSUInteger can be different lengths on their
different platforms (unsigned int on 32-bit, unsigned long on 64-bit).

Apple recommend using %lu and casting the argument to (unsigned long), which
is the route I've chosen in the attached patch. I _assume_ that's appropriate
on every platform GNUstep/GSWeb supports, but wanted to explicitly flag the
fact that I'd made this decision in preparing the patch.



_______________________________________________________

File Attachments:


-------------------------------------------------------
Date: Mon 27 May 2013 08:21:05 PM GMT Name: gsw-formatspecifiers.patch Size:
15kB By: leeg

<http://savannah.gnu.org/bugs/download.php?file_id=28188>

_______________________________________________________

Reply to this item at:

<http://savannah.gnu.org/bugs/?39087>

_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/


Sebastian Reitenbach

unread,
May 28, 2013, 11:26:49 AM5/28/13
to Sebastian Reitenbach, Graham Lee, bug-g...@gnu.org
Follow-up Comment #1, bug #39087 (project gnustep):

The patch looks good, applies fine, and doesn't seem to cause any trouble. But
normally, I use the PRIuPTR, and PRIiPTR format specifiers from inttypes.h, to
prevent all that casting, which I find more ugly than those format specifiers.
But that is only my personal taste.
Anyway, your way is also good, so let's see what David has to say about it,
then it will get addressed the one or other way.

Thanks,
Sebastian

Graham Lee

unread,
May 28, 2013, 11:45:19 AM5/28/13
to Sebastian Reitenbach, Graham Lee, bug-g...@gnu.org
Follow-up Comment #2, bug #39087 (project gnustep):

Thanks for looking at the patch. I've just checked the GNU coding standards
(and should've done so in advance):

> Don’t make the program ugly just to placate static analysis tools such as
lint, clang, and GCC with extra warnings options such as -Wconversion and
-Wundef. These tools can help find bugs and unclear code, but they can also
generate so many false alarms that it hurts readability to silence them with
unnecessary casts, wrappers, and other complications. For example, please
don’t insert casts to void or calls to do-nothing functions merely to pacify
a lint checker.

so maybe the appropriate fix is to turn off that warning, instead of this
patch :-(.

Sebastian Reitenbach

unread,
May 29, 2013, 1:09:57 PM5/29/13
to Sebastian Reitenbach, Graham Lee, bug-g...@gnu.org
Update of bug #39087 (project gnustep):

Status: None => Ready For Test
Assigned to: None => buzzdee

_______________________________________________________

Follow-up Comment #3:

Hi Graham,

svn rev. 36679 now should fix the addressed issues, but I used the PRIuPTR
types defined in inttypes.h instead of your approach.

Let me know if that works for you too.

Graham Lee

unread,
May 29, 2013, 1:46:04 PM5/29/13
to Sebastian Reitenbach, Graham Lee, bug-g...@gnu.org
Follow-up Comment #4, bug #39087 (project gnustep):

That's great, now it builds cleanly for me too :). Thanks!

Sebastian Reitenbach

unread,
May 29, 2013, 4:57:08 PM5/29/13
to Sebastian Reitenbach, Graham Lee, bug-g...@gnu.org
Update of bug #39087 (project gnustep):

Status: Ready For Test => Fixed

Sebastian Reitenbach

unread,
Dec 21, 2013, 2:11:07 AM12/21/13
to Sebastian Reitenbach, Graham Lee, bug-g...@gnu.org
Update of bug #39087 (project gnustep):

Open/Closed: Open => Closed
0 new messages