GNU bug report logs -
#74971
[PATCH] Fix format specifier warnings in nsterm.m
Previous Next
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 74971 in the body.
You can then email your comments to 74971 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#74971
; Package
emacs
.
(Thu, 19 Dec 2024 13:29:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Charalampos Mitrodimas <charmitro <at> posteo.net>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Thu, 19 Dec 2024 13:29:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
Resolve warnings caused by mismatched format specifiers in `NSLog` and
`fprintf` calls.
This was observed when compiled with Clang version
19.1.6 (arm64-apple-darwin).
* src/nsterm.m: Cast `IOReturn` (aka `int`) to `unsigned int` for `%x`
format specifiers in `NSLog`.
Warnings fixed:
- "format specifies type 'unsigned int' but the argument has type
'IOReturn' (aka 'int')"
---
src/nsterm.m | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/src/nsterm.m b/src/nsterm.m
index c705a3c78f4..5793bb961e8 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -6955,8 +6955,12 @@ In that case we use UCKeyTranslate (ns_get_shifted_character)
#ifndef NS_IMPL_GNUSTEP
if (NS_KEYLOG)
- fprintf (stderr, "keyDown: code =%x\tfnKey =%x\tflags = %x\tmods = %x\n",
- code, fnKeysym, flags, emacs_event->modifiers);
+ fprintf (stderr,
+ "keyDown: code = %x\tfnKey = %x\tflags = %x\tmods = "
+ "%x\n",
+ (unsigned int) code, (unsigned int) fnKeysym,
+ (unsigned int) flags,
+ (unsigned int) emacs_event->modifiers);
#endif
/* If it was a function key or had control-like modifiers, pass
@@ -10761,7 +10765,7 @@ - (CGContextRef) getContext
IOReturn lockStatus = IOSurfaceLock (surface, 0, nil);
if (lockStatus != kIOReturnSuccess)
- NSLog (@"Failed to lock surface: %x", lockStatus);
+ NSLog (@"Failed to lock surface: %x", (unsigned int)lockStatus);
[self copyContentsTo:surface];
@@ -10808,7 +10812,7 @@ - (void) releaseContext
IOReturn lockStatus = IOSurfaceUnlock (currentSurface, 0, nil);
if (lockStatus != kIOReturnSuccess)
- NSLog (@"Failed to unlock surface: %x", lockStatus);
+ NSLog (@"Failed to unlock surface: %x", (unsigned int)lockStatus);
}
@@ -10849,7 +10853,8 @@ - (void) copyContentsTo: (IOSurfaceRef) destination
lockStatus = IOSurfaceLock (source, kIOSurfaceLockReadOnly, nil);
if (lockStatus != kIOReturnSuccess)
- NSLog (@"Failed to lock source surface: %x", lockStatus);
+ NSLog (@"Failed to lock source surface: %x",
+ (unsigned int) lockStatus);
sourceData = IOSurfaceGetBaseAddress (source);
destinationData = IOSurfaceGetBaseAddress (destination);
@@ -10861,7 +10866,7 @@ - (void) copyContentsTo: (IOSurfaceRef) destination
lockStatus = IOSurfaceUnlock (source, kIOSurfaceLockReadOnly, nil);
if (lockStatus != kIOReturnSuccess)
- NSLog (@"Failed to unlock source surface: %x", lockStatus);
+ NSLog (@"Failed to unlock source surface: %x", (unsigned int)lockStatus);
}
#undef CACHE_MAX_SIZE
--
2.47.1
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#74971
; Package
emacs
.
(Thu, 26 Dec 2024 07:55:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 74971 <at> debbugs.gnu.org (full text, mbox):
> Cc: Charalampos Mitrodimas <charmitro <at> posteo.net>
> From: Charalampos Mitrodimas <charmitro <at> posteo.net>
> Date: Thu, 19 Dec 2024 13:28:05 +0000
>
> Resolve warnings caused by mismatched format specifiers in `NSLog` and
> `fprintf` calls.
>
> This was observed when compiled with Clang version
> 19.1.6 (arm64-apple-darwin).
>
> * src/nsterm.m: Cast `IOReturn` (aka `int`) to `unsigned int` for `%x`
> format specifiers in `NSLog`.
>
> Warnings fixed:
> - "format specifies type 'unsigned int' but the argument has type
> 'IOReturn' (aka 'int')"
> ---
> src/nsterm.m | 17 +++++++++++------
> 1 file changed, 11 insertions(+), 6 deletions(-)
>
> diff --git a/src/nsterm.m b/src/nsterm.m
> index c705a3c78f4..5793bb961e8 100644
> --- a/src/nsterm.m
> +++ b/src/nsterm.m
> @@ -6955,8 +6955,12 @@ In that case we use UCKeyTranslate (ns_get_shifted_character)
>
> #ifndef NS_IMPL_GNUSTEP
> if (NS_KEYLOG)
> - fprintf (stderr, "keyDown: code =%x\tfnKey =%x\tflags = %x\tmods = %x\n",
> - code, fnKeysym, flags, emacs_event->modifiers);
> + fprintf (stderr,
> + "keyDown: code = %x\tfnKey = %x\tflags = %x\tmods = "
> + "%x\n",
> + (unsigned int) code, (unsigned int) fnKeysym,
> + (unsigned int) flags,
> + (unsigned int) emacs_event->modifiers);
> #endif
>
> /* If it was a function key or had control-like modifiers, pass
> @@ -10761,7 +10765,7 @@ - (CGContextRef) getContext
>
> IOReturn lockStatus = IOSurfaceLock (surface, 0, nil);
> if (lockStatus != kIOReturnSuccess)
> - NSLog (@"Failed to lock surface: %x", lockStatus);
> + NSLog (@"Failed to lock surface: %x", (unsigned int)lockStatus);
>
> [self copyContentsTo:surface];
>
> @@ -10808,7 +10812,7 @@ - (void) releaseContext
>
> IOReturn lockStatus = IOSurfaceUnlock (currentSurface, 0, nil);
> if (lockStatus != kIOReturnSuccess)
> - NSLog (@"Failed to unlock surface: %x", lockStatus);
> + NSLog (@"Failed to unlock surface: %x", (unsigned int)lockStatus);
> }
>
>
> @@ -10849,7 +10853,8 @@ - (void) copyContentsTo: (IOSurfaceRef) destination
>
> lockStatus = IOSurfaceLock (source, kIOSurfaceLockReadOnly, nil);
> if (lockStatus != kIOReturnSuccess)
> - NSLog (@"Failed to lock source surface: %x", lockStatus);
> + NSLog (@"Failed to lock source surface: %x",
> + (unsigned int) lockStatus);
>
> sourceData = IOSurfaceGetBaseAddress (source);
> destinationData = IOSurfaceGetBaseAddress (destination);
> @@ -10861,7 +10866,7 @@ - (void) copyContentsTo: (IOSurfaceRef) destination
>
> lockStatus = IOSurfaceUnlock (source, kIOSurfaceLockReadOnly, nil);
> if (lockStatus != kIOReturnSuccess)
> - NSLog (@"Failed to unlock source surface: %x", lockStatus);
> + NSLog (@"Failed to unlock source surface: %x", (unsigned int)lockStatus);
> }
>
> #undef CACHE_MAX_SIZE
> --
> 2.47.1
Thanks.
Stefan and Gerd, would you please review this and advise or install?
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#74971
; Package
emacs
.
(Thu, 26 Dec 2024 08:04:02 GMT)
Full text and
rfc822 format available.
Message #11 received at 74971 <at> debbugs.gnu.org (full text, mbox):
> Cc: Charalampos Mitrodimas <charmitro <at> posteo.net>
> From: Charalampos Mitrodimas <charmitro <at> posteo.net>
> Date: Thu, 19 Dec 2024 13:28:05 +0000
>
> Resolve warnings caused by mismatched format specifiers in `NSLog` and
> `fprintf` calls.
>
> This was observed when compiled with Clang version
> 19.1.6 (arm64-apple-darwin).
>
> * src/nsterm.m: Cast `IOReturn` (aka `int`) to `unsigned int` for `%x`
> format specifiers in `NSLog`.
>
> Warnings fixed:
> - "format specifies type 'unsigned int' but the argument has type
> 'IOReturn' (aka 'int')"
> ---
> src/nsterm.m | 17 +++++++++++------
> 1 file changed, 11 insertions(+), 6 deletions(-)
>
> diff --git a/src/nsterm.m b/src/nsterm.m
> index c705a3c78f4..5793bb961e8 100644
> --- a/src/nsterm.m
> +++ b/src/nsterm.m
> @@ -6955,8 +6955,12 @@ In that case we use UCKeyTranslate (ns_get_shifted_character)
>
> #ifndef NS_IMPL_GNUSTEP
> if (NS_KEYLOG)
> - fprintf (stderr, "keyDown: code =%x\tfnKey =%x\tflags = %x\tmods = %x\n",
> - code, fnKeysym, flags, emacs_event->modifiers);
> + fprintf (stderr,
> + "keyDown: code = %x\tfnKey = %x\tflags = %x\tmods = "
> + "%x\n",
> + (unsigned int) code, (unsigned int) fnKeysym,
> + (unsigned int) flags,
> + (unsigned int) emacs_event->modifiers);
> #endif
>
> /* If it was a function key or had control-like modifiers, pass
> @@ -10761,7 +10765,7 @@ - (CGContextRef) getContext
>
> IOReturn lockStatus = IOSurfaceLock (surface, 0, nil);
> if (lockStatus != kIOReturnSuccess)
> - NSLog (@"Failed to lock surface: %x", lockStatus);
> + NSLog (@"Failed to lock surface: %x", (unsigned int)lockStatus);
>
> [self copyContentsTo:surface];
>
> @@ -10808,7 +10812,7 @@ - (void) releaseContext
>
> IOReturn lockStatus = IOSurfaceUnlock (currentSurface, 0, nil);
> if (lockStatus != kIOReturnSuccess)
> - NSLog (@"Failed to unlock surface: %x", lockStatus);
> + NSLog (@"Failed to unlock surface: %x", (unsigned int)lockStatus);
> }
>
>
> @@ -10849,7 +10853,8 @@ - (void) copyContentsTo: (IOSurfaceRef) destination
>
> lockStatus = IOSurfaceLock (source, kIOSurfaceLockReadOnly, nil);
> if (lockStatus != kIOReturnSuccess)
> - NSLog (@"Failed to lock source surface: %x", lockStatus);
> + NSLog (@"Failed to lock source surface: %x",
> + (unsigned int) lockStatus);
>
> sourceData = IOSurfaceGetBaseAddress (source);
> destinationData = IOSurfaceGetBaseAddress (destination);
> @@ -10861,7 +10866,7 @@ - (void) copyContentsTo: (IOSurfaceRef) destination
>
> lockStatus = IOSurfaceUnlock (source, kIOSurfaceLockReadOnly, nil);
> if (lockStatus != kIOReturnSuccess)
> - NSLog (@"Failed to unlock source surface: %x", lockStatus);
> + NSLog (@"Failed to unlock source surface: %x", (unsigned int)lockStatus);
> }
>
> #undef CACHE_MAX_SIZE
> --
> 2.47.1
Thanks.
Stefan and Gerd, would you please review this and advise or install?
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#74971
; Package
emacs
.
(Thu, 26 Dec 2024 08:14:02 GMT)
Full text and
rfc822 format available.
Message #14 received at 74971 <at> debbugs.gnu.org (full text, mbox):
Eli Zaretskii <eliz <at> gnu.org> writes:
> Stefan and Gerd, would you please review this and advise or install?
LGTM. Apparently clang 19 became more picky.
Reply sent
to
Stefan Kangas <stefankangas <at> gmail.com>
:
You have taken responsibility.
(Thu, 26 Dec 2024 15:15:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
Charalampos Mitrodimas <charmitro <at> posteo.net>
:
bug acknowledged by developer.
(Thu, 26 Dec 2024 15:15:03 GMT)
Full text and
rfc822 format available.
Message #19 received at 74971-done <at> debbugs.gnu.org (full text, mbox):
Version: 31.1
Gerd Möllmann <gerd.moellmann <at> gmail.com> writes:
> Eli Zaretskii <eliz <at> gnu.org> writes:
>
>> Stefan and Gerd, would you please review this and advise or install?
>
> LGTM. Apparently clang 19 became more picky.
Thanks, installed on master as commit ab388851569. Closing.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Fri, 24 Jan 2025 12:24:11 GMT)
Full text and
rfc822 format available.
This bug report was last modified 141 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.