From owner-freebsd-arm@freebsd.org Tue Sep 26 05:45:43 2017 Return-Path: Delivered-To: freebsd-arm@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 05984E2FFD3 for ; Tue, 26 Sep 2017 05:45:43 +0000 (UTC) (envelope-from russ.haley@gmail.com) Received: from mail-wr0-x234.google.com (mail-wr0-x234.google.com [IPv6:2a00:1450:400c:c0c::234]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8F5F577CBF for ; Tue, 26 Sep 2017 05:45:42 +0000 (UTC) (envelope-from russ.haley@gmail.com) Received: by mail-wr0-x234.google.com with SMTP id a43so11467469wrc.0 for ; Mon, 25 Sep 2017 22:45:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=JBVWTqBJJQFymuZ/Cf8Zj+gee7Jtake6X5UMWOCz6vU=; b=jo8Ah04R9/nlc0vKZCBBaJIZIYkB1IHWHiOjNRDtI/9i/A6wVFEUxQ+T2bpkaT98+x ETbY2WPimiV1sofWfH3RNKSP2uVnX/ytfnE4hgKzxeLXRx0S4KiDDi8Xs17sMcVxBVzh m/2otDnyhK53Qzteg8xauYUUFui75ie8cqfga5CPEz7K7P3BmkgqBRGldAqaYdz4f7yZ c9OUe92+1iRk3CwtHDohmqG2w+bm+LQKunO2n3sapIFwF6uMufTUt58YauodG1ZY20LZ +MwZeeFuwDjYIhwHuepRoZNLFyQQtHKFJDFbAuqTyFX9dl5TTYWZ379gf/4yJwaDPL2d kong== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=JBVWTqBJJQFymuZ/Cf8Zj+gee7Jtake6X5UMWOCz6vU=; b=ljfpmfxgcynnVss57gEZo5+OREeGL1ApkxOQcia1jMmUWZesyR/B7UurvGAwGHbziP tYAtLvncp4569fGYT7KCViyQSE44AqDkwQlnOVRSXGnrYWlyMgAFEoUqwwWgnQ6eD9Kw +PgqDlaswUT6P/hDBhFZ9stJawrGrBUHEvrQobA58vSxTL0tNIv/dR9p2nvmzlaqzXBr xfA7PgyUzk4dCkbJRUvKNuohEkET2z9Mgels47t9EcVoBWqLKQbfCNwG+And9s5sPZCk 2NK0Md+PxnKhzIwxain2zpqXxynjSQeD8LVzRcXc9ki2LouPwLvdv23YeL1Vkpu4HY5J 2NuQ== X-Gm-Message-State: AHPjjUhjuw7XWBprGkGyryQ8MfzSO3fMDj8bgn53zw+hDpkQqFqNV8df XGFlplJKkyycZ6ox0ZIu+v/z2HyDPAOsWT1USIAfMbKV X-Google-Smtp-Source: AOwi7QAHTzrVJbW1bl88zK/Ciggnk2fUfiv8hLHIHvxwYMi/yfV/9cve85jWc5WCBFCcn7VvJ/0CjNAw+m+Sik8afVA= X-Received: by 10.46.29.5 with SMTP id d5mr3617493ljd.97.1506404741151; Mon, 25 Sep 2017 22:45:41 -0700 (PDT) MIME-Version: 1.0 Received: by 10.46.81.65 with HTTP; Mon, 25 Sep 2017 22:45:40 -0700 (PDT) In-Reply-To: References: From: Russell Haley Date: Mon, 25 Sep 2017 22:45:40 -0700 Message-ID: Subject: Re: Why does this compile? To: Mark Millard Cc: freebsd-arm Content-Type: text/plain; charset="UTF-8" X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Porting FreeBSD to ARM processors." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Sep 2017 05:45:43 -0000 You guys are awesome. Thanks so much! Russ On Mon, Sep 25, 2017 at 9:56 PM, Mark Millard wrote: > On 2017-Sep-25, at 9:38 PM, Russell Haley wrote: > >> I'm trying to compile the new dotnet core 2.0 and I've run into a C >> problem I don't understand. Since I ran the code to check it on my arm >> board, I'm going to ask here (the most knowledgeable fbsd C people I >> could ask). >> >> The cmake file is trying to test for a linux struct in_pktinfo: >> >> check_c_source_compiles( >> " >> #include <${SOCKET_INCLUDES}> >> int main() >> { >> struct in_pktinfo; >> return 0; >> } >> " >> HAVE_IN_PKTINFO) >> >> SOCKET_INCLUDES resolves to netinet/in.h so the final source is: >> >> #include >> >> int main() >> { >> struct in_pktinfo; >> return 0; >> } >> >> This compiles on FreeBSD current and apparently on 11 too. That's a >> bad thing because it's supposed to fail. I checked in.h and there is >> no struct for in_pktinfo. Not surprisingly, if I remove the include >> altogether, it still compiles. > > struct in_pktinfo; > > declares but does not define the struct type. Not even > the size is known --but nothing is done that needs > to use even the size. > > By contrast the below would need the definition > of the struct type in question: > > #include > > int main() > { > struct in_pktinfo struct_instance; > return 0; > } > >> I assume then that the original author made a mistake? My C is too >> weak and most of my searches don't turn up anything close to what I'm >> looking for. > > The program needs to have something that requires > seeing the definition of the type, such as needing > its size. > >> Any suggestions would be awesome. :) > > check_c_source_compiles( > " > #include <${SOCKET_INCLUDES}> > int main() > { > struct in_pktinfo struct_instance; > return 0; > } > " > HAVE_IN_PKTINFO) > > > === > Mark Millard > markmi at dsl-only.net >