From nobody Fri Mar 24 21:27:24 2023 X-Original-To: dev-commits-ports-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PjwK92GdTz418k3; Fri, 24 Mar 2023 21:27:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PjwK91NjVz3kyr; Fri, 24 Mar 2023 21:27:25 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679693245; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=p8UaQL+TbpORZKCaB53ckDrEfLLy2gcYS5euzk9OUyY=; b=BLEQ5CpVWoRlO+39xpJLYJM5qdlueTqIJyBMy43x1WQ0P+gpyzssWIvafOfHSZ24wWf6VN LLLrTjazXJlxBPniPydO+xgkiqY5XDBO0io2WSGkf6oYH4phORAZeOzTiGInlH7rdajOxq Gube1IMmFu/YzLb2OOh2eRmERMyC3LE1uJqQiYpnTHb7YO+DTJOXL5ZOfkKSx/+XVtOpKI XbDDNDvj6KU1qQAOoakgC507t2mjdQyLfunR5rkBtWWCZZdEdnYrMPuR+Ce1hqdpfKjdsC I5Yw31PdV3Rsy7R4ih5yMS6i8DqaM7XwbrI3GjWTiDR1CeRLW9cHotU2jFmHXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679693245; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=p8UaQL+TbpORZKCaB53ckDrEfLLy2gcYS5euzk9OUyY=; b=CkkAuUUaxgvViz3Cx7Y5QbI/ut8rBuYDON1SPJ4vKupPyrsXykgI5Izn4z5oOBHFbaTCh0 Lu67tqqE1yLhoWy54shptGKYrfWunvJBbI65FwBgVS6ffn79Z5LYPpvSrKpeMqepxKv85N 30MBjhB+OkaFUHG18FplVuG7u79awXKq9Ygr+gUgIhNA2uEkvnVg9x1Hw/2/Lw7Bb/5Lcm NofnzgmdGICljcq9tGn5TS0TkNm7WiY1grPBxDbvhvtMak/dSUUZ2bwjw1eupp4efKEkSQ PmAR8XiZg4BPQZHONxhr9ptaEIktlscw4cS88IY19mOoye2heK5AL09b83nDdA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679693245; a=rsa-sha256; cv=none; b=lb0jDJDVU0Bu0x1Yz+rU2CCWTdK/C3PsuwlZAEISrlG44PSb2qWvy/62dF74SLG94dApaU tB5d1p72y5Vcum1u0U1PiM4kIPqDfFeG0s9J775IfEfx/gYwFyU0oDd5zN6UKWX+BhcDEX JNCLR2DOnGZUzGeyk33AUdlcLOCewNmIQn1pZO/qPunJluS75X1l1mip8Sl/A3pC1xewXu TmAoJNPqVF1RHMmaNl6BEVPj0YK7TbXE95R9qnA/7zP6DFPALGRgsDdU9SwcWkb+k6gPzk o+woYSdaHRo+UV1IXrdW17F5dzYwNQ9Vji7jJW2KBT3Z+rJ6uwbrhzSfCHSK/Q== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PjwK90D15zYv5; Fri, 24 Mar 2023 21:27:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 32OLROv2038607; Fri, 24 Mar 2023 21:27:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32OLROWq038606; Fri, 24 Mar 2023 21:27:24 GMT (envelope-from git) Date: Fri, 24 Mar 2023 21:27:24 GMT Message-Id: <202303242127.32OLROWq038606@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: Christoph Moench-Tegeder Subject: git: 12ebb5e5de4b - main - cad/kicad: fix failure in certain modes (e.g. exports) List-Id: Commit messages for all branches of the ports repository List-Archive: https://lists.freebsd.org/archives/dev-commits-ports-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-ports-all@freebsd.org X-BeenThere: dev-commits-ports-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cmt X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 12ebb5e5de4b1107fbd48dda4ae44e2afda985ba Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by cmt: URL: https://cgit.FreeBSD.org/ports/commit/?id=12ebb5e5de4b1107fbd48dda4ae44e2afda985ba commit 12ebb5e5de4b1107fbd48dda4ae44e2afda985ba Author: Christoph Moench-Tegeder AuthorDate: 2023-03-24 21:24:45 +0000 Commit: Christoph Moench-Tegeder CommitDate: 2023-03-24 21:24:45 +0000 cad/kicad: fix failure in certain modes (e.g. exports) The use of dynamic_case here results in failures (error exits) and seems to be actually wrong, which is exposed by our clang (mabe gcc handles this just fine? PR: 270273 Reported By: Pero Orsolic --- cad/kicad/Makefile | 1 + .../files/patch-job_use_dynamic_cast_for_updating | 171 +++++++++++++++++++++ 2 files changed, 172 insertions(+) diff --git a/cad/kicad/Makefile b/cad/kicad/Makefile index 461b38343a5d..5894e5d6dad0 100644 --- a/cad/kicad/Makefile +++ b/cad/kicad/Makefile @@ -1,5 +1,6 @@ PORTNAME= kicad PORTVERSION= 7.0.1 +PORTREVISION= 1 PORTEPOCH= 2 CATEGORIES= cad MASTER_SITES= https://gitlab.com/${PORTNAME}/code/${PORTNAME}/-/archive/${DISTVERSION}${DISTVERSIONSUFFIX}/ diff --git a/cad/kicad/files/patch-job_use_dynamic_cast_for_updating b/cad/kicad/files/patch-job_use_dynamic_cast_for_updating new file mode 100644 index 000000000000..9b6be4f43bcd --- /dev/null +++ b/cad/kicad/files/patch-job_use_dynamic_cast_for_updating @@ -0,0 +1,171 @@ +commit d631231335b93cbccc7e0c12a2dcd3296ea5ab29 +Author: Christoph Moench-Tegeder +Date: Fri Mar 24 21:59:39 2023 +0100 + + do not use dynamic_cast for upcasting to JOB + + Based on my understanding of dynamic_cast, the base class needs + to be virtual when upcasting a pointer of a derived object to one + of it's base classes, and JOB is "not virtual enough", at least not + for clang c++ (at least version 15 and 13, as reported by Pero Orsolic + on https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=270273 - I + re-verified the problem on LLVM 13 myself). + This changes all obvious cases of the upcast-to-JOB to static_cast, + I did not check for other classes (there are just too many for doing + that in my spare time). + + Credits to Pero Orsolic for reporting the first cases of this in the + PDF export in https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=270273 . + +diff --git eeschema/eeschema_jobs_handler.cpp eeschema/eeschema_jobs_handler.cpp +index 61462793ee..ce312d5100 100644 +--- eeschema/eeschema_jobs_handler.cpp ++++ eeschema/eeschema_jobs_handler.cpp +@@ -111,7 +111,7 @@ REPORTER& EESCHEMA_JOBS_HANDLER::Report( const wxString& aText, SEVERITY aSeveri + + int EESCHEMA_JOBS_HANDLER::JobExportPdf( JOB* aJob ) + { +- JOB_EXPORT_SCH_PDF* aPdfJob = dynamic_cast( aJob ); ++ JOB_EXPORT_SCH_PDF* aPdfJob = static_cast( aJob ); + + if( !aPdfJob ) + return CLI::EXIT_CODES::ERR_UNKNOWN; +@@ -147,7 +147,7 @@ int EESCHEMA_JOBS_HANDLER::JobExportPdf( JOB* aJob ) + + int EESCHEMA_JOBS_HANDLER::JobExportSvg( JOB* aJob ) + { +- JOB_EXPORT_SCH_SVG* aSvgJob = dynamic_cast( aJob ); ++ JOB_EXPORT_SCH_SVG* aSvgJob = static_cast( aJob ); + + if( !aSvgJob ) + return CLI::EXIT_CODES::ERR_UNKNOWN; +@@ -183,7 +183,7 @@ int EESCHEMA_JOBS_HANDLER::JobExportSvg( JOB* aJob ) + + int EESCHEMA_JOBS_HANDLER::JobExportNetlist( JOB* aJob ) + { +- JOB_EXPORT_SCH_NETLIST* aNetJob = dynamic_cast( aJob ); ++ JOB_EXPORT_SCH_NETLIST* aNetJob = static_cast( aJob ); + + if( !aNetJob ) + return CLI::EXIT_CODES::ERR_UNKNOWN; +@@ -281,7 +281,7 @@ int EESCHEMA_JOBS_HANDLER::JobExportNetlist( JOB* aJob ) + + int EESCHEMA_JOBS_HANDLER::JobExportPythonBom( JOB* aJob ) + { +- JOB_EXPORT_SCH_PYTHONBOM* aNetJob = dynamic_cast( aJob ); ++ JOB_EXPORT_SCH_PYTHONBOM* aNetJob = static_cast( aJob ); + + SCHEMATIC* sch = EESCHEMA_HELPERS::LoadSchematic( aNetJob->m_filename, SCH_IO_MGR::SCH_KICAD ); + +@@ -447,7 +447,7 @@ int EESCHEMA_JOBS_HANDLER::doSymExportSvg( JOB_SYM_EXPORT_SVG* aSvgJob, + + int EESCHEMA_JOBS_HANDLER::JobSymExportSvg( JOB* aJob ) + { +- JOB_SYM_EXPORT_SVG* svgJob = dynamic_cast( aJob ); ++ JOB_SYM_EXPORT_SVG* svgJob = static_cast( aJob ); + + wxFileName fn( svgJob->m_libraryPath ); + fn.MakeAbsolute(); +@@ -510,7 +510,7 @@ int EESCHEMA_JOBS_HANDLER::JobSymExportSvg( JOB* aJob ) + + int EESCHEMA_JOBS_HANDLER::JobSymUpgrade( JOB* aJob ) + { +- JOB_SYM_UPGRADE* upgradeJob = dynamic_cast( aJob ); ++ JOB_SYM_UPGRADE* upgradeJob = static_cast( aJob ); + + wxFileName fn( upgradeJob->m_libraryPath ); + fn.MakeAbsolute(); +diff --git pcbnew/pcbnew_jobs_handler.cpp pcbnew/pcbnew_jobs_handler.cpp +index be0f806dea..e045f864de 100644 +--- pcbnew/pcbnew_jobs_handler.cpp ++++ pcbnew/pcbnew_jobs_handler.cpp +@@ -76,7 +76,7 @@ PCBNEW_JOBS_HANDLER::PCBNEW_JOBS_HANDLER() + + int PCBNEW_JOBS_HANDLER::JobExportStep( JOB* aJob ) + { +- JOB_EXPORT_PCB_STEP* aStepJob = dynamic_cast( aJob ); ++ JOB_EXPORT_PCB_STEP* aStepJob = static_cast( aJob ); + + if( aStepJob == nullptr ) + return CLI::EXIT_CODES::ERR_UNKNOWN; +@@ -119,7 +119,7 @@ int PCBNEW_JOBS_HANDLER::JobExportStep( JOB* aJob ) + + int PCBNEW_JOBS_HANDLER::JobExportSvg( JOB* aJob ) + { +- JOB_EXPORT_PCB_SVG* aSvgJob = dynamic_cast( aJob ); ++ JOB_EXPORT_PCB_SVG* aSvgJob = static_cast( aJob ); + + if( aSvgJob == nullptr ) + return CLI::EXIT_CODES::ERR_UNKNOWN; +@@ -152,7 +152,7 @@ int PCBNEW_JOBS_HANDLER::JobExportSvg( JOB* aJob ) + + int PCBNEW_JOBS_HANDLER::JobExportDxf( JOB* aJob ) + { +- JOB_EXPORT_PCB_DXF* aDxfJob = dynamic_cast( aJob ); ++ JOB_EXPORT_PCB_DXF* aDxfJob = static_cast( aJob ); + + if( aDxfJob == nullptr ) + return CLI::EXIT_CODES::ERR_UNKNOWN; +@@ -207,7 +207,7 @@ int PCBNEW_JOBS_HANDLER::JobExportDxf( JOB* aJob ) + + int PCBNEW_JOBS_HANDLER::JobExportPdf( JOB* aJob ) + { +- JOB_EXPORT_PCB_PDF* aPdfJob = dynamic_cast( aJob ); ++ JOB_EXPORT_PCB_PDF* aPdfJob = static_cast( aJob ); + + if( aPdfJob == nullptr ) + return CLI::EXIT_CODES::ERR_UNKNOWN; +@@ -257,7 +257,7 @@ int PCBNEW_JOBS_HANDLER::JobExportPdf( JOB* aJob ) + + int PCBNEW_JOBS_HANDLER::JobExportGerbers( JOB* aJob ) + { +- JOB_EXPORT_PCB_GERBERS* aGerberJob = dynamic_cast( aJob ); ++ JOB_EXPORT_PCB_GERBERS* aGerberJob = static_cast( aJob ); + + if( aGerberJob == nullptr ) + return CLI::EXIT_CODES::ERR_UNKNOWN; +@@ -368,7 +368,7 @@ void PCBNEW_JOBS_HANDLER::populateGerberPlotOptionsFromJob( PCB_PLOT_PARAMS& + + int PCBNEW_JOBS_HANDLER::JobExportGerber( JOB* aJob ) + { +- JOB_EXPORT_PCB_GERBER* aGerberJob = dynamic_cast( aJob ); ++ JOB_EXPORT_PCB_GERBER* aGerberJob = static_cast( aJob ); + + if( aGerberJob == nullptr ) + return CLI::EXIT_CODES::ERR_UNKNOWN; +@@ -414,7 +414,7 @@ static DRILL_PRECISION precisionListForMetric( 3, 3 ); + + int PCBNEW_JOBS_HANDLER::JobExportDrill( JOB* aJob ) + { +- JOB_EXPORT_PCB_DRILL* aDrillJob = dynamic_cast( aJob ); ++ JOB_EXPORT_PCB_DRILL* aDrillJob = static_cast( aJob ); + + if( aDrillJob == nullptr ) + return CLI::EXIT_CODES::ERR_UNKNOWN; +@@ -522,7 +522,7 @@ int PCBNEW_JOBS_HANDLER::JobExportDrill( JOB* aJob ) + + int PCBNEW_JOBS_HANDLER::JobExportPos( JOB* aJob ) + { +- JOB_EXPORT_PCB_POS* aPosJob = dynamic_cast( aJob ); ++ JOB_EXPORT_PCB_POS* aPosJob = static_cast( aJob ); + + if( aPosJob == nullptr ) + return CLI::EXIT_CODES::ERR_UNKNOWN; +@@ -597,7 +597,7 @@ extern FOOTPRINT* try_load_footprint( const wxFileName& aFileName, IO_MGR::PCB_F + + int PCBNEW_JOBS_HANDLER::JobExportFpUpgrade( JOB* aJob ) + { +- JOB_FP_UPGRADE* upgradeJob = dynamic_cast( aJob ); ++ JOB_FP_UPGRADE* upgradeJob = static_cast( aJob ); + + if( upgradeJob == nullptr ) + return CLI::EXIT_CODES::ERR_UNKNOWN; +@@ -668,7 +668,7 @@ int PCBNEW_JOBS_HANDLER::JobExportFpUpgrade( JOB* aJob ) + + int PCBNEW_JOBS_HANDLER::JobExportFpSvg( JOB* aJob ) + { +- JOB_FP_EXPORT_SVG* svgJob = dynamic_cast( aJob ); ++ JOB_FP_EXPORT_SVG* svgJob = static_cast( aJob ); + + if( svgJob == nullptr ) + return CLI::EXIT_CODES::ERR_UNKNOWN;