Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: "Martin Storsjö" <martin@martin.st>
To: ffmpeg-devel@ffmpeg.org
Subject: Re: [FFmpeg-devel] [PATCH] w32pthreads: Fix function signature mismatches for CreateThread
Date: Fri, 4 Aug 2023 14:40:17 +0300 (EEST)
Message-ID: <c2cfb9ce-a1e8-1222-40ec-ffbbec4fb933@martin.st> (raw)
In-Reply-To: <20230802070301.31623-1-martin@martin.st>

On Wed, 2 Aug 2023, Martin Storsjö wrote:

> In WinRT mode, we use CreateThread instead of _beginthreadex.
>
> CreateThread takes a LPTHREAD_START_ROUTINE function pointer,
> which has got the signature DWORD WINAPI ThreadProc(LPVOID).
> _beginthreadex takes a function with the signature
> unsigned __stdcall func(void *).
>
> DWORD is defined as an unsigned long, which is different type
> from unsigned int, even if they have the same size on Windows.
>
> This fixes build failures with Clang 16 and newer, where function
> pointer type mismatches are a fatal error by default.
> ---
> compat/w32pthreads.h | 9 ++++++++-
> 1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/compat/w32pthreads.h b/compat/w32pthreads.h
> index 6405e72b64..dae8d9420d 100644
> --- a/compat/w32pthreads.h
> +++ b/compat/w32pthreads.h
> @@ -66,7 +66,14 @@ typedef CONDITION_VARIABLE pthread_cond_t;
> #define PTHREAD_CANCEL_ENABLE 1
> #define PTHREAD_CANCEL_DISABLE 0
>
> -static av_unused unsigned __stdcall attribute_align_arg win32thread_worker(void *arg)
> +#if HAVE_WINRT
> +#define THREADFUNC_RETTYPE DWORD
> +#else
> +#define THREADFUNC_RETTYPE unsigned
> +#endif
> +
> +static av_unused THREADFUNC_RETTYPE
> +__stdcall attribute_align_arg win32thread_worker(void *arg)
> {
>     pthread_t *h = (pthread_t*)arg;
>     h->ret = h->func(h->arg);
> -- 
> 2.34.1

Will push soon if there's no objections, as this is rather trivial.

// Martin
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

      reply	other threads:[~2023-08-04 11:40 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-02  7:03 Martin Storsjö
2023-08-04 11:40 ` Martin Storsjö [this message]

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=c2cfb9ce-a1e8-1222-40ec-ffbbec4fb933@martin.st \
    --to=martin@martin.st \
    --cc=ffmpeg-devel@ffmpeg.org \
    /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

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git