bugGNUstep - Bugs: bug #39087, Various format specifier problems...

Group
 
 

bug #39087: Various format specifier problems cause build to fail

Submitter:  Graham Lee <leeg>
Submitted:  Mon 27 May 2013 08:21:05 PM UTC
   
 
Category:  gsweb Severity:  3 - Normal
Item Group:  Bug Status:  Fixed
Privacy:  Public Assigned to:  buzzdee
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

Wed 29 May 2013 05:46:04 PM UTC, comment #4: 

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

Graham Lee <leeg>
Wed 29 May 2013 05:09:57 PM UTC, 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.


Sebastian Reitenbach <buzzdee>
Group Member
Tue 28 May 2013 03:45:19 PM UTC, comment #2: 

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 :-(.

Graham Lee <leeg>
Tue 28 May 2013 03:26:48 PM UTC, comment #1: 

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

Sebastian Reitenbach <buzzdee>
Group Member
Mon 27 May 2013 08:21:05 PM UTC, original submission:  

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.

Graham Lee <leeg>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #28188:  gsw-formatspecifiers.patch added by leeg (15KiB - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by buzzdee (Posted a comment)
  • -email is unavailable- added by leeg (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2013-12-21 buzzdee Open/ClosedOpen Closed
    2013-05-29 buzzdee StatusReady For Test Fixed
    2013-05-29 buzzdee StatusNone Ready For Test
        Assigned toNone buzzdee
    2013-05-27 leeg Attached File- Added gsw-formatspecifiers.patch, #28188

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code