From nobody Wed Sep 7 15:09:57 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4MN5K21N3yz4ccyr; Wed, 7 Sep 2022 15:09:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4MN5K20sYTz3XNJ; Wed, 7 Sep 2022 15:09:58 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1662563398; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=8CxZ2WJRB3deqpNo7MQTPoiG+3UsZEFXujnev2EQkdA=; b=S+5+UiNUJIBPvdhMsfuh1+0e6XkDVTTJzx60Jb5CoJsyy/pZBb82yhVXm9sqQ+L7qzWZbZ iaXwrP3nmvdPqEP2z1J7CAUIhQE5C92ZgnJHRumUUaEznVgXPJxeT3XlCWIFK8TqgKHjQn vyTa8zi5znLB7iyoYDYHZ3hhMcJJQgVWe5XpxkZh8s3NXOly1Z9Y+1NUfAvFBGc4mp+sOF H+Dju7GeOIgRdPHEe/Jzpo7bgZRMO4lrm83KBcH1o+fyqxMzCoOOt4irSRsRnhmooazqyy blEGUa1fvNpBV5CKXgAZHQyQ6K08ECo0HtheoKqHcGg7S+8UzurSRJnai6bnwA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4MN5K175bpzZ2M; Wed, 7 Sep 2022 15:09:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 287F9v9u017266; Wed, 7 Sep 2022 15:09:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 287F9vBH017265; Wed, 7 Sep 2022 15:09:57 GMT (envelope-from git) Date: Wed, 7 Sep 2022 15:09:57 GMT Message-Id: <202209071509.287F9vBH017265@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Emmanuel Vadot Subject: git: 860d777158f9 - stable/13 - linuxkpi: Add typecheck.h List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 860d777158f99124561d37cdcc811ecd571bf1a7 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1662563398; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=8CxZ2WJRB3deqpNo7MQTPoiG+3UsZEFXujnev2EQkdA=; b=N7NY+FLE2eI7IrP7CZ0jRuNoEmuBf1RAZi0AW/qN5J6b97sr6hmY6WFVHy0hRIIt7fav0e XpWINKfxbqBObSfJFgHUCzFdgMHXGZxFezA0ACX8My8wqiRsMqkFT0YEy/tZ9TuV6tgvy7 apNJP6r2+NsZfQPS6hBS5mCY0G4AAo91yMuU5FmdgQUS03ZgFIDAC4m2nskhg9jTLIINxR BhivHw8HE/gYL+rm9TsLUnGNs8mrqhzPWFnl/5z3Rp1SGO88+bIJiQkO9rYzbeSeqGLx2x nEZlBKB1gxc7r0Sd4FKHqEFJ6CQ5hKum10EuZj+pUPKB/bYfWPxCWWMHsD+ewg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1662563398; a=rsa-sha256; cv=none; b=M4fZ+91vxO6eP8h6dr0gsZA8czVGi8YYabaVjx0AjE7yyFJ8f/VLoITsfJsq57BhMwelLj UbkJfcVC1MuVTMh+cMjSNmM3XZqoNna7fdD/igpXVexoI+kUhAmbj31toZrKxXrZApumAK Aipb8wzcL4v+H/8gqutFLBuSO6C5KQlLfySCTCxXiMMmWWuYi4NmkPHIAjGEgFqnaKEFKf MRBKlA8ysMuo13KixYeF0JcqTGf9qbreXa4l+1YGFe7tHZ6pzJu4p1Lk5em2rs/Hf+XI/k keA4DGMa5DV0smK2PgRKPAm/v1XsOm5YAJeRTKWsMGpGSeJM+n7oUpSEniFeCw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=860d777158f99124561d37cdcc811ecd571bf1a7 commit 860d777158f99124561d37cdcc811ecd571bf1a7 Author: Emmanuel Vadot AuthorDate: 2022-06-23 08:10:07 +0000 Commit: Emmanuel Vadot CommitDate: 2022-09-07 15:09:02 +0000 linuxkpi: Add typecheck.h typecheck macro check if the type of a variable matches a type. MFC after: 1 week Sponsored by: Beckhoff Automation GmbH & Co. KG Differential Revision: https://reviews.freebsd.org/D35569 (cherry picked from commit 631bf94fe9dffb48377061e5b95812990f687b3d) --- .../linuxkpi/common/include/linux/typecheck.h | 38 ++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/typecheck.h b/sys/compat/linuxkpi/common/include/linux/typecheck.h new file mode 100644 index 000000000000..0e813962a7f5 --- /dev/null +++ b/sys/compat/linuxkpi/common/include/linux/typecheck.h @@ -0,0 +1,38 @@ +/*- + * Copyright (c) 2022 Beckhoff Automation GmbH & Co. KG + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ + +#ifndef _LINUXKPI_LINUX_TYPECHECK_H_ +#define _LINUXKPI_LINUX_TYPECHECK_H_ + +#define typecheck(type,x) \ +({ type __var1; \ + typeof(x) __var2; \ + (void)(&__var1 == &__var2); \ + 1; \ +}) + + +#endif /* _LINUXKPI_LINUX_TYPECHECK_H_ */