From: Marcin Bernatowicz <marcin.bernatowicz@linux.intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Marcin Bernatowicz <marcin.bernatowicz@linux.intel.com>,
Matt Roper <matthew.d.roper@intel.com>,
Kamil Konieczny <kamil.konieczny@linux.intel.com>
Subject: [PATCH i-g-t] tests/intel/drm_fdinfo: Fix type comparison warning
Date: Fri, 2 Aug 2024 12:51:20 +0200 [thread overview]
Message-ID: <20240802105120.586924-1-marcin.bernatowicz@linux.intel.com> (raw)
Resolve a compilation warning caused by comparing distinct pointer
types without a cast in the max macro usage.
Cc: Matt Roper <matthew.d.roper@intel.com>
Cc: Kamil Konieczny <kamil.konieczny@linux.intel.com>
Fixes: dd461382e7fa ("tests/intel: Apply igt.cocci transforms")
Signed-off-by: Marcin Bernatowicz <marcin.bernatowicz@linux.intel.com>
---
../lib/igt_aux.h:229:35: warning: comparison of distinct pointer types
lacks a cast
229 | (!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
| ^~
../lib/igt_aux.h:246:3: note: in expansion of macro ‘__typecheck’
246 | (__typecheck(x, y) && __no_side_effects(x, y))
| ^~~~~~~~~~~
../lib/igt_aux.h:249:24: note: in expansion of macro ‘__safe_cmp’
249 | __builtin_choose_expr(__safe_cmp(x, y), \
| ^~~~~~~~~~
../lib/igt_aux.h:254:19: note: in expansion of macro ‘__careful_cmp’
254 | #define max(x, y) __careful_cmp(x, y, >, max)
| ^~~~~~~~~~~~~
../tests/intel/drm_fdinfo.c:808:9: note: in expansion of macro ‘max’
808 | return max(count, 0U);
tests/intel/drm_fdinfo.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/intel/drm_fdinfo.c b/tests/intel/drm_fdinfo.c
index 160dc3d0a..43216a64e 100644
--- a/tests/intel/drm_fdinfo.c
+++ b/tests/intel/drm_fdinfo.c
@@ -805,7 +805,7 @@ static size_t read_fdinfo(char *buf, const size_t sz, int at, const char *name)
buf[count - 1] = 0;
close(fd);
- return max(count, 0);
+ return max_t(typeof(count), count, 0);
}
/*
--
2.31.1
next reply other threads:[~2024-08-02 10:51 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-02 10:51 Marcin Bernatowicz [this message]
2024-08-02 11:24 ` [PATCH i-g-t] tests/intel/drm_fdinfo: Fix type comparison warning Kamil Konieczny
2024-08-02 11:31 ` ✓ CI.xeBAT: success for " Patchwork
2024-08-02 11:43 ` ✓ Fi.CI.BAT: " Patchwork
2024-08-02 12:37 ` ✗ CI.xeFULL: failure " Patchwork
2024-08-02 12:47 ` Kamil Konieczny
2024-08-03 7:20 ` ✗ Fi.CI.IGT: " Patchwork
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240802105120.586924-1-marcin.bernatowicz@linux.intel.com \
--to=marcin.bernatowicz@linux.intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=kamil.konieczny@linux.intel.com \
--cc=matthew.d.roper@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox