* [PATCH 1/1] perf script python: Cope with declarations after statements found in Python.h
@ 2023-08-02 13:42 Arnaldo Carvalho de Melo
2023-08-02 17:31 ` Ian Rogers
0 siblings, 1 reply; 3+ messages in thread
From: Arnaldo Carvalho de Melo @ 2023-08-02 13:42 UTC (permalink / raw)
To: Namhyung Kim
Cc: Adrian Hunter, Ian Rogers, Jiri Olsa, Linux Kernel Mailing List
With -Werror the build was failing on fedora rawhide:
[perfbuilder@27cfe44d67ed perf-6.5.0-rc2]$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/13/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-redhat-linux
Configured with: ../configure --enable-bootstrap --enable-languages=c,c++,fortran,objc,obj-c++,ada,go,d,m2,lto --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-gcc-major-version-only --enable-libstdcxx-backtrace --with-libstdcxx-zoneinfo=/usr/share/zoneinfo --with-linker-hash-style=gnu --enable-plugin --enable-initfini-array --with-isl=/builddir/build/BUILD/gcc-13.2.1-20230728/obj-x86_64-redhat-linux/isl-install --enable-offload-targets=nvptx-none --without-cuda-driver --enable-offload-defaulted --enable-gnu-indirect-function --enable-cet --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux --with-build-config=bootstrap-lto --enable-link-serialization=1
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 13.2.1 20230728 (Red Hat 13.2.1-1) (GCC)
[perfbuilder@27cfe44d67ed perf-6.5.0-rc2]$
In file included from /usr/include/python3.12/Python.h:44,
from scripts/python/Perf-Trace-Util/Context.c:14:
/usr/include/python3.12/object.h: In function 'Py_SIZE':
/usr/include/python3.12/object.h:217:5: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]
217 | PyVarObject *var_ob = _PyVarObject_CAST(ob);
| ^~~~~~~~~~~
In file included from /usr/include/python3.12/Python.h:53:
/usr/include/python3.12/cpython/longintrepr.h: In function '_PyLong_CompactValue':
/usr/include/python3.12/cpython/longintrepr.h:121:5: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]
121 | Py_ssize_t sign = 1 - (op->long_value.lv_tag & _PyLong_SIGN_MASK);
| ^~~~~~~~~~
<SNIP>
In file included from /usr/include/python3.12/Python.h:44,
from util/scripting-engines/trace-event-python.c:22:
/usr/include/python3.12/object.h: In function 'Py_SIZE':
/usr/include/python3.12/object.h:217:5: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]
217 | PyVarObject *var_ob = _PyVarObject_CAST(ob);
| ^~~~~~~~~~~
CC /tmp/build/perf/util/units.o
CC /tmp/build/perf/util/time-utils.o
In file included from /usr/include/python3.12/Python.h:53:
/usr/include/python3.12/cpython/longintrepr.h: In function '_PyLong_CompactValue':
/usr/include/python3.12/cpython/longintrepr.h:121:5: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]
121 | Py_ssize_t sign = 1 - (op->long_value.lv_tag & _PyLong_SIGN_MASK);
| ^~~~~~~~~~
So add -Wno-declaration-after-statement to the python scripting CFLAGS.
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: https://lore.kernel.org/lkml/
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/scripts/python/Perf-Trace-Util/Build | 3 ++-
tools/perf/util/scripting-engines/Build | 3 ++-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/tools/perf/scripts/python/Perf-Trace-Util/Build b/tools/perf/scripts/python/Perf-Trace-Util/Build
index 7d0e33ce6aba44f4..5b0b5ff7e14afc50 100644
--- a/tools/perf/scripts/python/Perf-Trace-Util/Build
+++ b/tools/perf/scripts/python/Perf-Trace-Util/Build
@@ -1,3 +1,4 @@
perf-y += Context.o
-CFLAGS_Context.o += $(PYTHON_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-nested-externs
+# -Wno-declaration-after-statement: The python headers have mixed code with declarations (decls after asserts, for instance)
+CFLAGS_Context.o += $(PYTHON_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-nested-externs -Wno-declaration-after-statement
diff --git a/tools/perf/util/scripting-engines/Build b/tools/perf/util/scripting-engines/Build
index c220fec970324d85..586b94e90f4eb3b8 100644
--- a/tools/perf/util/scripting-engines/Build
+++ b/tools/perf/util/scripting-engines/Build
@@ -5,4 +5,5 @@ perf-$(CONFIG_LIBPYTHON) += trace-event-python.o
CFLAGS_trace-event-perl.o += $(PERL_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-shadow -Wno-nested-externs -Wno-undef -Wno-switch-default -Wno-bad-function-cast -Wno-declaration-after-statement -Wno-switch-enum
-CFLAGS_trace-event-python.o += $(PYTHON_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-shadow -Wno-deprecated-declarations -Wno-switch-enum
+# -Wno-declaration-after-statement: The python headers have mixed code with declarations (decls after asserts, for instance)
+CFLAGS_trace-event-python.o += $(PYTHON_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-shadow -Wno-deprecated-declarations -Wno-switch-enum -Wno-declaration-after-statement
--
2.37.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 1/1] perf script python: Cope with declarations after statements found in Python.h
2023-08-02 13:42 [PATCH 1/1] perf script python: Cope with declarations after statements found in Python.h Arnaldo Carvalho de Melo
@ 2023-08-02 17:31 ` Ian Rogers
2023-08-03 13:21 ` Arnaldo Carvalho de Melo
0 siblings, 1 reply; 3+ messages in thread
From: Ian Rogers @ 2023-08-02 17:31 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: Namhyung Kim, Adrian Hunter, Jiri Olsa, Linux Kernel Mailing List
On Wed, Aug 2, 2023 at 6:42 AM Arnaldo Carvalho de Melo <acme@kernel.org> wrote:
>
> With -Werror the build was failing on fedora rawhide:
>
> [perfbuilder@27cfe44d67ed perf-6.5.0-rc2]$ gcc -v
> Using built-in specs.
> COLLECT_GCC=gcc
> COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/13/lto-wrapper
> OFFLOAD_TARGET_NAMES=nvptx-none
> OFFLOAD_TARGET_DEFAULT=1
> Target: x86_64-redhat-linux
> Configured with: ../configure --enable-bootstrap --enable-languages=c,c++,fortran,objc,obj-c++,ada,go,d,m2,lto --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-gcc-major-version-only --enable-libstdcxx-backtrace --with-libstdcxx-zoneinfo=/usr/share/zoneinfo --with-linker-hash-style=gnu --enable-plugin --enable-initfini-array --with-isl=/builddir/build/BUILD/gcc-13.2.1-20230728/obj-x86_64-redhat-linux/isl-install --enable-offload-targets=nvptx-none --without-cuda-driver --enable-offload-defaulted --enable-gnu-indirect-function --enable-cet --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux --with-build-config=bootstrap-lto --enable-link-serialization=1
> Thread model: posix
> Supported LTO compression algorithms: zlib zstd
> gcc version 13.2.1 20230728 (Red Hat 13.2.1-1) (GCC)
> [perfbuilder@27cfe44d67ed perf-6.5.0-rc2]$
>
> In file included from /usr/include/python3.12/Python.h:44,
> from scripts/python/Perf-Trace-Util/Context.c:14:
> /usr/include/python3.12/object.h: In function 'Py_SIZE':
> /usr/include/python3.12/object.h:217:5: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]
> 217 | PyVarObject *var_ob = _PyVarObject_CAST(ob);
> | ^~~~~~~~~~~
> In file included from /usr/include/python3.12/Python.h:53:
> /usr/include/python3.12/cpython/longintrepr.h: In function '_PyLong_CompactValue':
> /usr/include/python3.12/cpython/longintrepr.h:121:5: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]
> 121 | Py_ssize_t sign = 1 - (op->long_value.lv_tag & _PyLong_SIGN_MASK);
> | ^~~~~~~~~~
> <SNIP>
> In file included from /usr/include/python3.12/Python.h:44,
> from util/scripting-engines/trace-event-python.c:22:
> /usr/include/python3.12/object.h: In function 'Py_SIZE':
> /usr/include/python3.12/object.h:217:5: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]
> 217 | PyVarObject *var_ob = _PyVarObject_CAST(ob);
> | ^~~~~~~~~~~
> CC /tmp/build/perf/util/units.o
> CC /tmp/build/perf/util/time-utils.o
> In file included from /usr/include/python3.12/Python.h:53:
> /usr/include/python3.12/cpython/longintrepr.h: In function '_PyLong_CompactValue':
> /usr/include/python3.12/cpython/longintrepr.h:121:5: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]
> 121 | Py_ssize_t sign = 1 - (op->long_value.lv_tag & _PyLong_SIGN_MASK);
> | ^~~~~~~~~~
>
> So add -Wno-declaration-after-statement to the python scripting CFLAGS.
>
> Cc: Adrian Hunter <adrian.hunter@intel.com>
> Cc: Ian Rogers <irogers@google.com>
> Cc: Jiri Olsa <jolsa@kernel.org>
> Cc: Namhyung Kim <namhyung@kernel.org>
> Link: https://lore.kernel.org/lkml/
> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Reviewed-by: Ian Rogers <irogers@google.com>
Thanks,
Ian
> ---
> tools/perf/scripts/python/Perf-Trace-Util/Build | 3 ++-
> tools/perf/util/scripting-engines/Build | 3 ++-
> 2 files changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/tools/perf/scripts/python/Perf-Trace-Util/Build b/tools/perf/scripts/python/Perf-Trace-Util/Build
> index 7d0e33ce6aba44f4..5b0b5ff7e14afc50 100644
> --- a/tools/perf/scripts/python/Perf-Trace-Util/Build
> +++ b/tools/perf/scripts/python/Perf-Trace-Util/Build
> @@ -1,3 +1,4 @@
> perf-y += Context.o
>
> -CFLAGS_Context.o += $(PYTHON_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-nested-externs
> +# -Wno-declaration-after-statement: The python headers have mixed code with declarations (decls after asserts, for instance)
> +CFLAGS_Context.o += $(PYTHON_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-nested-externs -Wno-declaration-after-statement
> diff --git a/tools/perf/util/scripting-engines/Build b/tools/perf/util/scripting-engines/Build
> index c220fec970324d85..586b94e90f4eb3b8 100644
> --- a/tools/perf/util/scripting-engines/Build
> +++ b/tools/perf/util/scripting-engines/Build
> @@ -5,4 +5,5 @@ perf-$(CONFIG_LIBPYTHON) += trace-event-python.o
>
> CFLAGS_trace-event-perl.o += $(PERL_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-shadow -Wno-nested-externs -Wno-undef -Wno-switch-default -Wno-bad-function-cast -Wno-declaration-after-statement -Wno-switch-enum
>
> -CFLAGS_trace-event-python.o += $(PYTHON_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-shadow -Wno-deprecated-declarations -Wno-switch-enum
> +# -Wno-declaration-after-statement: The python headers have mixed code with declarations (decls after asserts, for instance)
> +CFLAGS_trace-event-python.o += $(PYTHON_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-shadow -Wno-deprecated-declarations -Wno-switch-enum -Wno-declaration-after-statement
> --
> 2.37.1
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 1/1] perf script python: Cope with declarations after statements found in Python.h
2023-08-02 17:31 ` Ian Rogers
@ 2023-08-03 13:21 ` Arnaldo Carvalho de Melo
0 siblings, 0 replies; 3+ messages in thread
From: Arnaldo Carvalho de Melo @ 2023-08-03 13:21 UTC (permalink / raw)
To: Ian Rogers
Cc: Namhyung Kim, Adrian Hunter, Jiri Olsa, Linux Kernel Mailing List
Em Wed, Aug 02, 2023 at 10:31:21AM -0700, Ian Rogers escreveu:
> On Wed, Aug 2, 2023 at 6:42 AM Arnaldo Carvalho de Melo <acme@kernel.org> wrote:
> > So add -Wno-declaration-after-statement to the python scripting CFLAGS.
> >
> > Cc: Adrian Hunter <adrian.hunter@intel.com>
> > Cc: Ian Rogers <irogers@google.com>
> > Cc: Jiri Olsa <jolsa@kernel.org>
> > Cc: Namhyung Kim <namhyung@kernel.org>
> > Link: https://lore.kernel.org/lkml/
> > Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
>
> Reviewed-by: Ian Rogers <irogers@google.com>
Thanks, added the tag to both patches.
- Arnaldo
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-08-03 13:21 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-02 13:42 [PATCH 1/1] perf script python: Cope with declarations after statements found in Python.h Arnaldo Carvalho de Melo
2023-08-02 17:31 ` Ian Rogers
2023-08-03 13:21 ` Arnaldo Carvalho de Melo
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.