From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) by sourceware.org (Postfix) with ESMTPS id 5EB403858D28 for ; Fri, 31 Mar 2023 21:54:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5EB403858D28 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=jguk.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=jguk.org Received: by mail-wr1-x42e.google.com with SMTP id l12so23794651wrm.10 for ; Fri, 31 Mar 2023 14:54:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jguk.org; s=google; t=1680299667; h=content-transfer-encoding:subject:from:to:content-language :user-agent:mime-version:date:message-id:from:to:cc:subject:date :message-id:reply-to; bh=jxGh+LP1NLUsBiadJ1LxnbFYcz25jITgNXN0yB/wK6M=; b=S5mRQsjZJiw36T1tlJSkx6QN2Zdp7yDmvCQX3Mtre9iyYOhAQhkgvQDst92aoaJIFJ uRZbNZfsFuO4JAaU4e4Mm6fBhaNsl6ff6qXshIREXJgmeSKbK7TBhR8A62UK+7rlGtnb 1MYJBIggvKk8543U9E2Mz14XhFVTgQB0RniqxTpO175ZNQWQq8w+2uEJr5ZM4KHi2GyI aJszwdz725F+skd34BhcjfwKvKki/uanpk4fdt+Dwmcx25AAY9KjFi38kFJv2cSEJPw6 HO9xm5il9RB1AswXwH9+Empvn9scLQ5IZbU5Rl+gqePBAaamviNPqPlSz2eDkrajF0YI PqkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680299667; h=content-transfer-encoding:subject:from:to:content-language :user-agent:mime-version:date:message-id:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=jxGh+LP1NLUsBiadJ1LxnbFYcz25jITgNXN0yB/wK6M=; b=Rl4Y3Gu/ZyZKa53L1IXNaoTGLIw5ps7xG02ZLKWE0hmlPmcuRddYEeUrXbKEvLISBb i1Tq8TmugOw3O2Qi9soTuasIL7EVPEQC6kC28TWFXxI61xBIR9EAJgxlwYguhb8olqy4 ZoM6iNVPmJV7BafTWgapZuTNGM2TivlgCN3G6cASoChXu1BM8+CYsKcAzLepIc1tDGSs OgpFJ78HeXSZnRA4KpraMvgyJUU6FSfekG7YJU5wTkj5MCyGighQXrNyOvsMyT0OQVXJ 7S7ekW1RTt+9nxZcaP7VWv9AUENyzOkArQNh5IDAuqp9xtriCiOC/TJlZtgSKr3AeY07 quaw== X-Gm-Message-State: AAQBX9cLftNeSWlKrC/F5Ex0ViUDkJ0vRABciNr/EwdPZtehunv+UVia 2K048YrbQpfQdcrRDBK12eL7eXsb5f3CdELw7uQ= X-Google-Smtp-Source: AKy350Z3QDE6KZIBM3c5vlquj6l0oZt8e29yUHQSJGjMrO3MCEeSHKgfXIN+1eEYdeKfAF4muJkjrA== X-Received: by 2002:adf:f581:0:b0:2c5:4f45:90b0 with SMTP id f1-20020adff581000000b002c54f4590b0mr7884297wro.3.1680299666953; Fri, 31 Mar 2023 14:54:26 -0700 (PDT) Received: from [192.168.0.12] (cpc87345-slou4-2-0-cust172.17-4.cable.virginm.net. [81.101.252.173]) by smtp.gmail.com with ESMTPSA id b9-20020a5d6349000000b002cea8f07813sm3139163wrw.81.2023.03.31.14.54.26 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 31 Mar 2023 14:54:26 -0700 (PDT) Message-ID: <6dc16e33-647e-5bf5-4025-3e10141aaa66@jguk.org> Date: Fri, 31 Mar 2023 22:54:25 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.9.0 Content-Language: en-GB To: gcc-help From: Jonny Grant Subject: __attribute__ error ("message") Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3.0 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,KAM_SHORT,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Hello May I check, does this attribute error output the error message usually? My example links fine without any warnings or errors. Maybe I am misunderstanding it. I am sharing a simple program below and godbolt trunk example. I only get to see the error message if I don't implement the function and get a link failure. https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#Common-Function-Attributes error ("message") warning ("message") If the error or warning attribute is used on a function declaration and a call to such a function is not eliminated through dead code elimination or other optimizations, an error or warning (respectively) that includes message is diagnosed. https://godbolt.org/z/n849GPTjj void compile_abort() __attribute__((error("compile abort"))); void compile_abort() { __builtin_abort(); } int main() { compile_abort(); }