From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 996C543C3D; Tue, 5 Mar 2024 21:09:12 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 67523402B2; Tue, 5 Mar 2024 21:09:12 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mails.dpdk.org (Postfix) with ESMTP id 7EC1B402AC for ; Tue, 5 Mar 2024 21:09:11 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1709669351; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HfA5P30whnI0c8JuCbjeAjEVdiqV2DjjEqNYCc74zuI=; b=QnOZeM08irOvO3Cckv5Wuematfs54L4hvE9VB0RnZJL35h2EN/CFZ0IhQEMCrCpz/jQ5PD F2pV5MKSdXBXGOmvIT1HTxgXhIKRU1U0hqLjBFJY18nWT5TW6xg5gc4aZWVNYS73u+y/Le YfZGOZvleCYf5oGxFJVlvaUyEFYDFb4= Received: from mail-lf1-f72.google.com (mail-lf1-f72.google.com [209.85.167.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-329-eYGLwiVdNWa5QPplLR05Zw-1; Tue, 05 Mar 2024 15:09:07 -0500 X-MC-Unique: eYGLwiVdNWa5QPplLR05Zw-1 Received: by mail-lf1-f72.google.com with SMTP id 2adb3069b0e04-51325ba078dso4965312e87.3 for ; Tue, 05 Mar 2024 12:09:07 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709669346; x=1710274146; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=HfA5P30whnI0c8JuCbjeAjEVdiqV2DjjEqNYCc74zuI=; b=R5LygIvyYzTUXvNvAZ5Nvb5m/bXi998SMHC2327XJpSnV23wVxgZ56pocgyvXL2Bbp xyzeGdynf3ZWL7sqJnkCrePjguvjpJRzWoohNFblV2SpP8tuIr177y+GC5t7ik4ZuOV1 Fff91ArHPub+i424WWeAKc75deaX+/ggCr1I8o70xgfQjwCgVoB+r+H6o1jIYo7GONeH 4jaCM9sll58aSog6/X0GIA5ZYLe8UzMym995i8MtydQNXYYGAnU95O7F2hBoLg+DHg9f PI+Vt7e1EJYllfdpL6KkwRSDi9Dokaeea9F+I7wuHMg/RdZXJu2t1B4ZvO8qwTbl2rai a5Zw== X-Gm-Message-State: AOJu0YxcNEpukqvdidbsB6mkI9w5oxikfQYIx3POwCkunt2j48dV1721 SdUqQ4q3e8xZ8QQTq+gqNn3a4DMGNQwu4nEMhNT0hfmqfqEKKdxMUSGqxzvBNKNbF4ybU/RjsOf oZSwuQn3hx5Fo6HYHRifCWWmaCq35fV5KmFpwHpr/OBLVOCIOn3bsPtM4JLbJ1/MLEJM+REHg3U lJQebb3LnF9lEawLg= X-Received: by 2002:a05:6512:230b:b0:512:9857:34f3 with SMTP id o11-20020a056512230b00b00512985734f3mr2479277lfu.39.1709669346183; Tue, 05 Mar 2024 12:09:06 -0800 (PST) X-Google-Smtp-Source: AGHT+IEaXUO5bNiA8timkjd7v3heNa9isw1Z1VxbYIiFoe+Mf/yZQOhPyiH0iRj10i80o61/8cuswkaxbHnWSboml7A= X-Received: by 2002:a05:6512:230b:b0:512:9857:34f3 with SMTP id o11-20020a056512230b00b00512985734f3mr2479251lfu.39.1709669345770; Tue, 05 Mar 2024 12:09:05 -0800 (PST) MIME-Version: 1.0 References: <1707873986-29352-1-git-send-email-roretzla@linux.microsoft.com> <1709574764-9041-1-git-send-email-roretzla@linux.microsoft.com> In-Reply-To: <1709574764-9041-1-git-send-email-roretzla@linux.microsoft.com> From: David Marchand Date: Tue, 5 Mar 2024 21:08:54 +0100 Message-ID: Subject: Re: [PATCH v7 00/39] use C11 alignas To: Tyler Retzlaff , Thomas Monjalon Cc: dev@dpdk.org, Andrew Rybchenko , Bruce Richardson , Chengwen Feng , Cristian Dumitrescu , David Christensen , David Hunt , Ferruh Yigit , Honnappa Nagarahalli , Jasvinder Singh , Jerin Jacob , Kevin Laatz , Konstantin Ananyev , Min Zhou , Ruifeng Wang , Sameh Gobriel , Stanislaw Kardach , Vladimir Medvedkin , Yipeng Wang X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On Mon, Mar 4, 2024 at 6:53=E2=80=AFPM Tyler Retzlaff wrote: > > The current location used for __rte_aligned(a) for alignment of types > and variables is not compatible with MSVC. There is only a single > location accepted by both toolchains. > > For variables standard C11 offers alignas(a) supported by conformant > compilers i.e. both MSVC and GCC. > > For types the standard offers no alignment facility that compatibly > interoperates with C and C++ but may be achieved by relocating the > placement of __rte_aligned(a) to the aforementioned location accepted > by all currently supported toolchains. > > ** NOTE ** > > Finally, In the interest of not creating more API (internal or not) the > series does not introduce a wrapper for C11 alignas. If we don't introduc= e > a macro an application can't take a dependency. I have been looking into adding some check so that we catch new introductions of __rte_*aligned calls... Wdyt of: diff --git a/devtools/checkpatches.sh b/devtools/checkpatches.sh index c47ea59501..632397f42d 100755 --- a/devtools/checkpatches.sh +++ b/devtools/checkpatches.sh @@ -336,6 +336,21 @@ check_internal_tags() { # return $res } +check_aligned_attributes() { # + res=3D0 + + for token in __rte_aligned __rte_cache_aligned __rte_cache_min_aligned; do + if [ $(grep -E '^\+.*\<'$token'\>' "$1" | \ + grep -vE '\<(struct|union)[[:space:]]*'$token'\>' | \ + wc -l) !=3D 0 ]; then + echo "Please only use $token for struct or union types alignment." + res=3D1 + fi + done + + return $res +} + check_release_notes() { # rel_notes_prefix=3Ddoc/guides/rel_notes/release_ IFS=3D. read year month release < VERSION @@ -445,6 +460,14 @@ check () { # ret=3D1 fi + ! $verbose || printf '\nChecking alignment attributes:\n' + report=3D$(check_aligned_attributes "$tmpinput") + if [ $? -ne 0 ] ; then + $headline_printed || print_headline "$subject" + printf '%s\n' "$report" + ret=3D1 + fi + ! $verbose || printf '\nChecking release notes updates:\n' report=3D$(check_release_notes "$tmpinput") if [ $? -ne 0 ] ; then --=20 David Marchand