all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#74971: [PATCH] Fix format specifier warnings in nsterm.m
@ 2024-12-19 13:28 Charalampos Mitrodimas
  2024-12-26  7:54 ` Eli Zaretskii
  2024-12-26  7:54 ` Eli Zaretskii
  0 siblings, 2 replies; 5+ messages in thread
From: Charalampos Mitrodimas @ 2024-12-19 13:28 UTC (permalink / raw)
  To: 74971; +Cc: Charalampos Mitrodimas

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






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

* bug#74971: [PATCH] Fix format specifier warnings in nsterm.m
  2024-12-19 13:28 bug#74971: [PATCH] Fix format specifier warnings in nsterm.m Charalampos Mitrodimas
@ 2024-12-26  7:54 ` Eli Zaretskii
  2024-12-26  8:12   ` Gerd Möllmann
  2024-12-26  7:54 ` Eli Zaretskii
  1 sibling, 1 reply; 5+ messages in thread
From: Eli Zaretskii @ 2024-12-26  7:54 UTC (permalink / raw)
  To: Charalampos Mitrodimas, Gerd Möllmann, Stefan Kangas; +Cc: 74971

> Cc: Charalampos Mitrodimas <charmitro@posteo.net>
> From: Charalampos Mitrodimas <charmitro@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?





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

* bug#74971: [PATCH] Fix format specifier warnings in nsterm.m
  2024-12-19 13:28 bug#74971: [PATCH] Fix format specifier warnings in nsterm.m Charalampos Mitrodimas
  2024-12-26  7:54 ` Eli Zaretskii
@ 2024-12-26  7:54 ` Eli Zaretskii
  1 sibling, 0 replies; 5+ messages in thread
From: Eli Zaretskii @ 2024-12-26  7:54 UTC (permalink / raw)
  To: Charalampos Mitrodimas, Gerd Möllmann, Stefan Kangas; +Cc: 74971

> Cc: Charalampos Mitrodimas <charmitro@posteo.net>
> From: Charalampos Mitrodimas <charmitro@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?





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

* bug#74971: [PATCH] Fix format specifier warnings in nsterm.m
  2024-12-26  7:54 ` Eli Zaretskii
@ 2024-12-26  8:12   ` Gerd Möllmann
  2024-12-26 15:13     ` Stefan Kangas
  0 siblings, 1 reply; 5+ messages in thread
From: Gerd Möllmann @ 2024-12-26  8:12 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Charalampos Mitrodimas, Stefan Kangas, 74971

Eli Zaretskii <eliz@gnu.org> writes:

> Stefan and Gerd, would you please review this and advise or install?

LGTM. Apparently clang 19 became more picky.





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

* bug#74971: [PATCH] Fix format specifier warnings in nsterm.m
  2024-12-26  8:12   ` Gerd Möllmann
@ 2024-12-26 15:13     ` Stefan Kangas
  0 siblings, 0 replies; 5+ messages in thread
From: Stefan Kangas @ 2024-12-26 15:13 UTC (permalink / raw)
  To: Gerd Möllmann, Eli Zaretskii; +Cc: Charalampos Mitrodimas, 74971-done

Version: 31.1

Gerd Möllmann <gerd.moellmann@gmail.com> writes:

> Eli Zaretskii <eliz@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.





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

end of thread, other threads:[~2024-12-26 15:13 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-19 13:28 bug#74971: [PATCH] Fix format specifier warnings in nsterm.m Charalampos Mitrodimas
2024-12-26  7:54 ` Eli Zaretskii
2024-12-26  8:12   ` Gerd Möllmann
2024-12-26 15:13     ` Stefan Kangas
2024-12-26  7:54 ` Eli Zaretskii

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

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.