From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id A90093858400 for ; Mon, 5 Sep 2022 16:20:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A90093858400 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1662394821; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type; bh=OoI3hAk1K+LSfOSKWk+8AzUu0B3Vjy2ujkOodWRhEWA=; b=X8yJJN0xklHPQTxes1kjyX54HhAhR8fHRPL5WmFxPleTF39jez/AfVlXmokLgTO/u+Q97G G/GwZR/bz2amxgfpP1rxQvUhi4tcM6w69pQDGksZeQ6FKD8tlcT4JSJ9RxRJ1oADJdZ2Gx zHpu81K0FtGb6t4+7b7t+qbsK8ZzecU= Received: from mail-qv1-f71.google.com (mail-qv1-f71.google.com [209.85.219.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-384-A0DIwvaPNxCLyNfk6P2TbQ-1; Mon, 05 Sep 2022 12:20:20 -0400 X-MC-Unique: A0DIwvaPNxCLyNfk6P2TbQ-1 Received: by mail-qv1-f71.google.com with SMTP id g4-20020ad45424000000b004a9bb302c85so904631qvt.22 for ; Mon, 05 Sep 2022 09:20:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:user-agent:message-id:date:organization:subject:to :from:x-gm-message-state:from:to:cc:subject:date; bh=OoI3hAk1K+LSfOSKWk+8AzUu0B3Vjy2ujkOodWRhEWA=; b=wLd6tPt831n1WWPWUtXAcGrA51ylImkz82rUtGAazGkzslml8pLlZ8jbmZJcVTsaDE mfYdc2jcNfO4gS8fy2NdtM4hv/VOqnIeauMx1AmsmKZdzlyf0rVD8pBos0kU6wXU7DrY XpHOvJKonpTzs9UJYsZMoxTnfvKfcP8pzGCex7hLq8cJ/TthApbPLXALhq242LAS6xbO JHjTq0vrfjWoY07EVGGp8Pky2l83wRmJ1G6VqgjK6G24Smj3x1yXaABBJkjFQUtrJPh/ IWsIoym52Y2ZSbRNGYGwmnVqR/wt5ZXBjMWPyvjCGC0xFQfL4/ifswlguhHMcOwQUHR5 XSkQ== X-Gm-Message-State: ACgBeo0QqBA8mZIgergsO6jXjurFv5tlzhRNdJBgsVhQkPKemxGXS9Gu Wbl/C1ja5bo4HWkDnrwM29TZFa4AGL6uDE+bpr/VrmGvhFVm7uYhNIxItdjC5+1n7inrKn1tfJl Abt8pRF2F484nCDpimNiA1+PBPy46T5QG65HBAun74qSAXJShGHnc+mFepqpZ7Wujjt+X X-Received: by 2002:a05:6214:e69:b0:499:1b4b:a7e8 with SMTP id jz9-20020a0562140e6900b004991b4ba7e8mr23694162qvb.12.1662394819758; Mon, 05 Sep 2022 09:20:19 -0700 (PDT) X-Google-Smtp-Source: AA6agR6ilOgikBdjMj7vm+FS9ZY67N/eaMLFMZ2Fw0qutgr5yZVCoh390C6LaXmY6CDggI+vtiRJag== X-Received: by 2002:a05:6214:e69:b0:499:1b4b:a7e8 with SMTP id jz9-20020a0562140e6900b004991b4ba7e8mr23694142qvb.12.1662394819434; Mon, 05 Sep 2022 09:20:19 -0700 (PDT) Received: from localhost ([88.120.130.27]) by smtp.gmail.com with ESMTPSA id w17-20020a05620a445100b006b8fb2a1145sm8836409qkp.124.2022.09.05.09.20.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Sep 2022 09:20:18 -0700 (PDT) Received: by localhost (Postfix, from userid 1000) id 177FB5802BD; Mon, 5 Sep 2022 18:20:16 +0200 (CEST) From: Dodji Seketeli To: libabigail@sourceware.org Subject: [PATCH, applied] ir: translation_unit::is_empty should work without environment. Organization: Red Hat / France X-Operating-System: Fedora 38 X-URL: http://www.redhat.com Date: Mon, 05 Sep 2022 18:20:16 +0200 Message-ID: <87edwpkd33.fsf@redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-11.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE 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, I noticed that some code failed trying to call translation_unit::is_empty in the absence of the instance of the abigail::ir::environment type used to create the IR. This is because translation_unit::is_empty was trying to create something. That's odd. It shouldn't need to create anything to test for its emptiness. Fixed thus. * src/abg-ir.cc (translation_unit::is_empty): If there is no global scope, then we know its empty. No need to create one. Signed-off-by: Dodji Seketeli --- src/abg-ir.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/abg-ir.cc b/src/abg-ir.cc index 7c8b6640..91c8e99b 100644 --- a/src/abg-ir.cc +++ b/src/abg-ir.cc @@ -1353,7 +1353,11 @@ translation_unit::get_loc_mgr() const /// @return true iff the current translation unit is empty. bool translation_unit::is_empty() const -{return get_global_scope()->is_empty();} +{ + if (!priv_->global_scope_) + return true; + return get_global_scope()->is_empty(); +} /// Getter of the address size in this translation unit. /// -- 2.37.2 -- Dodji