From patchwork Wed Jan 16 04:23:58 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Chris Packham X-Patchwork-Id: 212386 X-Patchwork-Delegate: albert.aribaud@free.fr Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 2D94A2C0094 for ; Wed, 16 Jan 2013 15:29:32 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 2CB064A03F; Wed, 16 Jan 2013 05:29:28 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Hh9-BOSEs8eT; Wed, 16 Jan 2013 05:29:27 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 3D6844A041; Wed, 16 Jan 2013 05:29:26 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id A171E4A041 for ; Wed, 16 Jan 2013 05:29:18 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 1+q8NLe4+as0 for ; Wed, 16 Jan 2013 05:29:17 +0100 (CET) X-Greylist: delayed 315 seconds by postgrey-1.27 at theia; Wed, 16 Jan 2013 05:29:16 CET X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-oa0-f50.google.com (mail-oa0-f50.google.com [209.85.219.50]) by theia.denx.de (Postfix) with ESMTPS id 760F94A03F for ; Wed, 16 Jan 2013 05:29:16 +0100 (CET) Received: by mail-oa0-f50.google.com with SMTP id n16so995034oag.9 for ; Tue, 15 Jan 2013 20:29:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=t+dKFUUZjOaVGOFeLe6IMg285Ejdtt0KdosFGJGEBDA=; b=OcPs2HIkpx8lgjtRs4x9O1nYRxj96sCMRDJVRCvCVzgL3zlUY7PpZgqs7PoXkY4vAo Pa4DfbKfS6YU4mBMd0sQZboKbixvW2xl4maH2QVbhTMHIejjYQ2Tg5z6TAWYyJ+GHvo/ MkX2bUDgSYLaTLvnOCb53PL6QWeWHO3B1Oe3Eklx7KoH+nEYxzQD0ETxsd8SVf6gkngu pak4k7dtknrgQr2PvvYvDAaSyvExfNQutH3x+lCj2BO8ErX8bDA1C/1PNCjikavXOdqP 80pZ3tdBG6E1OdOIYoA65c8lhZONrc//bGcyUQRZLmlAsZL6KIs5CSVXZnmWjjMvWtkF gr+w== MIME-Version: 1.0 Received: by 10.182.187.66 with SMTP id fq2mr25114488obc.86.1358310238403; Tue, 15 Jan 2013 20:23:58 -0800 (PST) Received: by 10.76.68.38 with HTTP; Tue, 15 Jan 2013 20:23:58 -0800 (PST) Date: Wed, 16 Jan 2013 17:23:58 +1300 Message-ID: From: Chris Packham To: u-boot X-Content-Filtered-By: Mailman/MimeDel 2.1.11 Subject: [U-Boot] Function prototype conflicts with standalone apps X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de Hi, I've just run into something porting an existing out of tree board to u-boot 2012.10 but I think it points to a generic issue for standalone applications. Consider the following change Because I'm not linking with the u-boot object file, I should be able to use any function name I like in my application as long as it isn't one of the functions in exports.h (at least in theory). Unfortunately I end up with the following compiler error hello_world.c:27: error: conflicting types for ‘net_init’ uboot/include/net.h:489: error: previous declaration of ‘net_init’ was here make[1]: *** [hello_world.o] Error 1 If I replace #include in my app with the first hunk of includes from the top of common.h then I can compile just fine. I was wondering if it made sense to people to have standalone applications define something like __STANDALONE__ either via CPPFLAGS or in the source itself and use the presence of that to exclude the majority of common.h when used in standalone applications. Or alternatively move the required bits to exports.h. Thanks, Chris diff --git a/examples/standalone/hello_world.c b/examples/standalone/hello_world.c index 067c390..d2e6a77 100644 --- a/examples/standalone/hello_world.c +++ b/examples/standalone/hello_world.c @@ -24,7 +24,7 @@ #include #include -int hello_world (int argc, char * const argv[]) +int net_init (int argc, char * const argv[]) { int i;