From patchwork Wed Sep 25 18:45:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 174403 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp1017473ill; Wed, 25 Sep 2019 11:48:12 -0700 (PDT) X-Google-Smtp-Source: APXvYqzIt4+q99GWhX23tMaY1HfKfUw9Eo1cGAcAfAkpnqQGnBFR3rpeOZFw5lhVzwJYlpYf/VzV X-Received: by 2002:a17:906:4b47:: with SMTP id j7mr654980ejv.63.1569437292805; Wed, 25 Sep 2019 11:48:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569437292; cv=none; d=google.com; s=arc-20160816; b=e03TsuZLkBjgjDBi4338G68wDbWn+ceOvkkWKIntEAfrFYq7IAwPoEr0/4HqOn0726 Lf7URo45QG85ojfljRi1iG8eeNcJkPJ1+CY1fKMc+VYhZVgMoTWegrG6Fcv+4hYhntf7 2LOS04W9dCNEh9s/T/PAumUryV8aRI6zXabLLzZWrEwPuuAHzTV1KwNiBuI6ncGSE3Gb efQbcTXKjQEzkyYIkh6UDpRPJEOB32tLZNvgb2GooznqoE6Oy7w18axJ68vf+/QNOZcr SI66sGCISW4esftYZjBgyjOelt9S3wc4YFsH5SO9CzUtiRvkNQF537Ye7oRC5yZfHeO9 mgIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=Cgi8cwP/kPiakDiYJkRI89bBSyLkz6ovsWz2x/LD2wI=; b=fluwEidybGgMCSI8k2kR0HFFmZzO79ik9V23pZLkj0UVw8b28DFWD/hzULYdkwI+1u +KfPK1w0443ie1zudgNSCeJS4GAtn95hplK7y1gSky23zona0G8qTbqC1lqsxrM+P330 ueuUDcCYyxDq930AX+kOr2+evXZ99XIiH8WAObF5LFuWw5cwSxCxrM8K7AwzJZ3JXsan p/D75fYjWT8A6/ZpyhX0xRJ8lNHDA6LxpeUECrzzn1xZvJd6ZG7/Hd0qpU0kSvVLv/z7 CcPBfO+iCfeTTQ8HvK0nuKbTQEfF/GwD9I16Sm9P70wDteWJV5ZBl5U0kBkB8WcHyZre eWmQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pEfhyXa3; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id v2si250455eju.3.2019.09.25.11.48.12 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Sep 2019 11:48:12 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pEfhyXa3; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:55974 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iDCKh-0001iS-1b for patch@linaro.org; Wed, 25 Sep 2019 14:48:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46972) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iDCIX-0001fl-Ey for qemu-devel@nongnu.org; Wed, 25 Sep 2019 14:45:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iDCIW-0004DL-HY for qemu-devel@nongnu.org; Wed, 25 Sep 2019 14:45:57 -0400 Received: from mail-pf1-x42f.google.com ([2607:f8b0:4864:20::42f]:45504) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iDCIW-0004CN-Bu for qemu-devel@nongnu.org; Wed, 25 Sep 2019 14:45:56 -0400 Received: by mail-pf1-x42f.google.com with SMTP id y72so4134536pfb.12 for ; Wed, 25 Sep 2019 11:45:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Cgi8cwP/kPiakDiYJkRI89bBSyLkz6ovsWz2x/LD2wI=; b=pEfhyXa3LMv/9lv5T4yuYVMwG0mRmtmPtjlMft6HTOfQ6SZaQQKmNcgDXBCGvpyRhY zR6DJxm27kK5KLsB5eEnkJD8js6yPO3Fc8W7PfqB/DGr6nTYf8L/w2kdrloIU8hhrLh9 9Kq8U1vjAUeIgmFWq979TJz3nnkjpxZ9o3fyw7n6Xv8dIJFFG1MGsHF+U4KVuQPWFPlZ kZ3hGKz4X9gR4Jf7fcwNcGXyahW1nLq92gpvRg7FSA91TN9RsBKJtci0/yT5SYqsTloL NYWuTEFNZ8AcgS3BxnnEf9GCdfevnrfGLiAyS3MYCUZ0Ng4WQyVFJDPglySWNL1CJaWb nPqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Cgi8cwP/kPiakDiYJkRI89bBSyLkz6ovsWz2x/LD2wI=; b=WLuR6pNu1LptV8y8PRxEMHcL+jPsymJ+sSSjhwHEWwDw36dxxauAgCfWHjpjcbpdKm SMLfdYpAV3lgtT6nSKoGZ7bjYKn9SJn4+xoKB93L4Z9ES3rqKQlqb/A48ctTWpdEuJa/ RA4r2XVci4djg3lQtQ7Oy8Uf6NRxPtvgQ3le5cqWr7vlgEtXqD3b2Ei5tl/JBzXGaiMH 1c3GheJGz218ipqBkS9gB38A5HTinx0WcS4NOilkeXHA9EFYkR2+fGZEU6UuqZI6p6Wk eXgV1xP12N08DLwEfXqeHm15FBAimqL1MR7udGCCb5STDYT0JOj5VCv+6gM1PKlm1C3d HvsQ== X-Gm-Message-State: APjAAAX6pCSZTV1zcgFy4m9n6ROcL1Oni4ry3cUEvLtoNDDOTiajq7xl VJhCNb1uUyt6gyk6L3j1RyZioJR2Feo= X-Received: by 2002:a62:db84:: with SMTP id f126mr11647089pfg.25.1569437154916; Wed, 25 Sep 2019 11:45:54 -0700 (PDT) Received: from localhost.localdomain ([12.206.46.61]) by smtp.gmail.com with ESMTPSA id l24sm6133229pff.151.2019.09.25.11.45.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Sep 2019 11:45:54 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 03/16] qemu/compiler.h: Add qemu_build_not_reached Date: Wed, 25 Sep 2019 11:45:35 -0700 Message-Id: <20190925184548.30673-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190925184548.30673-1-richard.henderson@linaro.org> References: <20190925184548.30673-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::42f X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Use this as a compile-time assert that a particular code path is not reachable. Reviewed-by: Alex Bennée Signed-off-by: Richard Henderson --- include/qemu/compiler.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) -- 2.17.1 diff --git a/include/qemu/compiler.h b/include/qemu/compiler.h index 20780e722d..7b93c73340 100644 --- a/include/qemu/compiler.h +++ b/include/qemu/compiler.h @@ -221,4 +221,19 @@ #define QEMU_GENERIC9(x, a0, ...) QEMU_GENERIC_IF(x, a0, QEMU_GENERIC8(x, __VA_ARGS__)) #define QEMU_GENERIC10(x, a0, ...) QEMU_GENERIC_IF(x, a0, QEMU_GENERIC9(x, __VA_ARGS__)) +/** + * qemu_build_not_reached() + * + * The compiler, during optimization, is expected to prove that a call + * to this function cannot be reached and remove it. If the compiler + * supports QEMU_ERROR, this will be reported at compile time; otherwise + * this will be reported at link time due to the missing symbol. + */ +#ifdef __OPTIMIZE__ +extern void QEMU_NORETURN QEMU_ERROR("code path is reachable") + qemu_build_not_reached(void); +#else +#define qemu_build_not_reached() g_assert_not_reached() +#endif + #endif /* COMPILER_H */