From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-yw1-x1132.google.com (mail-yw1-x1132.google.com [IPv6:2607:f8b0:4864:20::1132]) by sourceware.org (Postfix) with ESMTPS id B49AB3858D38 for ; Thu, 22 Sep 2022 16:24:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org B49AB3858D38 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-yw1-x1132.google.com with SMTP id 00721157ae682-3450990b0aeso104044517b3.12 for ; Thu, 22 Sep 2022 09:24:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:to:subject:message-id:date:from:reply-to :mime-version:from:to:cc:subject:date; bh=98KnJF5UzfVRLr4R1ebCIfat92PLD16M44TpILuI0WI=; b=YQvyWcD2s898RfEf6ZOr3F5kHi4dU0MfH0cPuJEgZiG52Z3i+6oAe1dpxptmIkc23D KHIhHMomH8dMq1WpsOv2nsvzNns2qs3dO+YvAlti4usgYyRQBsB5XgBPkwHAjZMUuxjr 2GDqf1ceMFyDsutvTxlW+ndWMMKYWygh73UNGDegyxn1sagl/KefD0BJL5C8rogtG08r FM7dwaqrxkn4/9jpWRT1y0+u3ULBIAuhaydZDborGuwMM9UQtYJKhiVbxIXlBz1YB+qj bIpHGi7NepR30CIeywi8AjAvXZApemrf0qK+V7xrbN8kMXFrVXS/RVlRywxJXstj3Hhg vduw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:to:subject:message-id:date:from:reply-to :mime-version:x-gm-message-state:from:to:cc:subject:date; bh=98KnJF5UzfVRLr4R1ebCIfat92PLD16M44TpILuI0WI=; b=U/MD3r3oB9e6r4BeKjeKT10brDS816N09CM5ilqAGJBQc0VMs5DkHtSZON7mKpYU++ LJrZv2tGotLunnSxulaseoEVk/1gTQU/jcRNrOpNry/JNIpB58nqW/BZigFpoh+amJei lOaYmbne5Rtqj97E4lueuDVuH+pw/QlHuKfc3eqYoiDK2KloRKjSutEHC+tHbF/bDn84 9E7BVyU4wIRgdUXSZL8Gs9nmfdFX5OnN549fCP5UdQ4VebgDfTpHMn6jk5IARgq+k/l1 HCgK5DBc+frbvarjF/ji2aHqbzHZ9J7nUTylvfe5FRuDrkndyMqJDOgi03nkBZj0zyjR AmlA== X-Gm-Message-State: ACrzQf1W6Vfk1S3MV7xZwqdcfjOxKQqJy3XFo4tNM1yVpC3GGoD6eMAM DbSXlhv2dQavT7/WgvEMn4gf/eGYm/RizhvKlVE+BJOYYL0= X-Google-Smtp-Source: AMsMyM7LuKQOpFGPb/TB4MLA1jRJMEHEebeuPptsVLTxeG/zDSP/TcfjyxsLPyeWGIB+s401pMEUQcZ4mBLYSDyn6Bo= X-Received: by 2002:a0d:c981:0:b0:330:dc03:7387 with SMTP id l123-20020a0dc981000000b00330dc037387mr4031755ywd.380.1663863883818; Thu, 22 Sep 2022 09:24:43 -0700 (PDT) MIME-Version: 1.0 Reply-To: gb2985@gmail.com From: Lee Shallis Date: Thu, 22 Sep 2022 17:24:32 +0100 Message-ID: Subject: Declaring a function to be of wprintf style To: GCC Help Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=0.7 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,FREEMAIL_REPLYTO_END_DIGIT,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: I attempted this: #ifdef __GNUC__ #define PAW__ATTR_PRINTF(ARGS_POS,VA_POS) \ __attribute__((format (printf, ARGS_POS, VA_POS))) #define PAW__ATTR_WPRINTF(ARGS_POS,VA_POS) \ __attribute__((format (wprintf, ARGS_POS, VA_POS))) #else #define PAW__ATTR_PRINTF(ARGS_POS,VA_POS) #define PAW__ATTR_WPRINTF(ARGS_POS,VA_POS) #endif #ifdef _DEBUG #define PAW_ATTR_PRINTF(ARGS_POS,VA_POS) PAW__ATTR_PRINTF(ARGS_POS,VA_POS) #define PAW_ATTR_WPRINTF(ARGS_POS,VA_POS) PAW__ATTR_WPRINTF(ARGS_POS,VA_POS= ) #else #define PAW_ATTR_PRINTF(ARGS_POS,VA_POS) #define PAW_ATTR_WPRINTF(ARGS_POS,VA_POS) #endif But gcc gave this "error: =E2=80=98wprintf=E2=80=99 is an unrecognized form= at function type", I also tried just printf but then it complained the args parameter was not of char const * Is there anyway to declare it to be of that style and if so is there a way to extend what it checks for as I have some custom modifiers for the string types & and some extra specifiers, 3 of which can change what is expected to be found in the args, namely what options are sought out, what modifiers are sought out and what specifiers are sought out, I would greatly appreciate being able to get my arguments checked for type mis-matches in the default scenarios during compile time