[v2,0/7] Enable -Wmissing-declarations diagnostic

Message ID 20200110220027.26450-1-simon.marchi@efficios.com
Headers show
Series
  • Enable -Wmissing-declarations diagnostic
Related show

Message

Simon Marchi Jan. 10, 2020, 10 p.m.
This is v2 of:

  https://sourceware.org/ml/gdb-patches/2019-11/msg00805.html

Although a few patches of the original series were merged, since they
were valid fixes in any case.

I have re-generated the configure script for gdbserver, which I had
forgotten in v1, and it of course unearthed some more issues.

I have build-tested the series with gcc 7.4.0 and clang 9.

Simon Marchi (7):
  gdb: add back declarations for _initialize functions
  gdb: add declaration to Python init function
  gdbserver: include hostio.h in hostio-errno.c
  gdbserver: include gdbsupport/common-inferior.h in inferiors.c
  gdbserver: make some functions static in linux-x86-low.c
  gdbserver: set IP_AGENT_EXPORT_FUNC to static when not building IPA,
    add declarations
  Enable -Wmissing-declarations diagnostic

 gdb/aarch64-fbsd-nat.c                        |  3 ++-
 gdb/aarch64-fbsd-tdep.c                       |  3 ++-
 gdb/aarch64-linux-nat.c                       |  3 ++-
 gdb/aarch64-linux-tdep.c                      |  3 ++-
 gdb/aarch64-newlib-tdep.c                     |  3 ++-
 gdb/aarch64-tdep.c                            |  3 ++-
 gdb/ada-exp.y                                 |  3 ++-
 gdb/ada-lang.c                                |  3 ++-
 gdb/ada-tasks.c                               |  3 ++-
 gdb/agent.c                                   |  3 ++-
 gdb/aix-thread.c                              |  3 ++-
 gdb/alpha-bsd-nat.c                           |  3 ++-
 gdb/alpha-linux-nat.c                         |  3 ++-
 gdb/alpha-linux-tdep.c                        |  3 ++-
 gdb/alpha-nbsd-tdep.c                         |  3 ++-
 gdb/alpha-obsd-tdep.c                         |  3 ++-
 gdb/alpha-tdep.c                              |  3 ++-
 gdb/amd64-darwin-tdep.c                       |  3 ++-
 gdb/amd64-dicos-tdep.c                        |  3 ++-
 gdb/amd64-fbsd-nat.c                          |  3 ++-
 gdb/amd64-fbsd-tdep.c                         |  3 ++-
 gdb/amd64-linux-nat.c                         |  3 ++-
 gdb/amd64-linux-tdep.c                        |  3 ++-
 gdb/amd64-nbsd-nat.c                          |  3 ++-
 gdb/amd64-nbsd-tdep.c                         |  3 ++-
 gdb/amd64-obsd-nat.c                          |  3 ++-
 gdb/amd64-obsd-tdep.c                         |  3 ++-
 gdb/amd64-sol2-tdep.c                         |  3 ++-
 gdb/amd64-tdep.c                              |  3 ++-
 gdb/amd64-windows-nat.c                       |  3 ++-
 gdb/amd64-windows-tdep.c                      |  3 ++-
 gdb/annotate.c                                |  3 ++-
 gdb/arc-newlib-tdep.c                         |  3 ++-
 gdb/arc-tdep.c                                |  3 ++-
 gdb/arch-utils.c                              |  3 ++-
 gdb/arm-fbsd-nat.c                            |  3 ++-
 gdb/arm-fbsd-tdep.c                           |  3 ++-
 gdb/arm-linux-nat.c                           |  3 ++-
 gdb/arm-linux-tdep.c                          |  3 ++-
 gdb/arm-nbsd-nat.c                            |  3 ++-
 gdb/arm-nbsd-tdep.c                           |  3 ++-
 gdb/arm-obsd-tdep.c                           |  3 ++-
 gdb/arm-pikeos-tdep.c                         |  3 ++-
 gdb/arm-symbian-tdep.c                        |  3 ++-
 gdb/arm-tdep.c                                |  3 ++-
 gdb/arm-wince-tdep.c                          |  3 ++-
 gdb/auto-load.c                               |  3 ++-
 gdb/auxv.c                                    |  3 ++-
 gdb/avr-tdep.c                                |  3 ++-
 gdb/ax-gdb.c                                  |  3 ++-
 gdb/bfin-linux-tdep.c                         |  3 ++-
 gdb/bfin-tdep.c                               |  3 ++-
 gdb/break-catch-sig.c                         |  3 ++-
 gdb/break-catch-syscall.c                     |  3 ++-
 gdb/break-catch-throw.c                       |  3 ++-
 gdb/breakpoint.c                              |  3 ++-
 gdb/bsd-uthread.c                             |  3 ++-
 gdb/btrace.c                                  |  3 ++-
 gdb/charset.c                                 |  3 ++-
 gdb/cli/cli-cmds.c                            |  3 ++-
 gdb/cli/cli-dump.c                            |  3 ++-
 gdb/cli/cli-interp.c                          |  3 ++-
 gdb/cli/cli-logging.c                         |  3 ++-
 gdb/cli/cli-script.c                          |  3 ++-
 gdb/cli/cli-style.c                           |  1 +
 gdb/coff-pe-read.c                            |  3 ++-
 gdb/coffread.c                                |  3 ++-
 gdb/compile/compile-cplus-types.c             |  1 +
 gdb/compile/compile.c                         |  3 ++-
 gdb/complaints.c                              |  3 ++-
 gdb/completer.c                               |  3 ++-
 gdb/configure                                 |  3 ++-
 gdb/copying.c                                 |  3 ++-
 gdb/corefile.c                                |  3 ++-
 gdb/corelow.c                                 |  3 ++-
 gdb/cp-abi.c                                  |  3 ++-
 gdb/cp-namespace.c                            |  3 ++-
 gdb/cp-support.c                              |  3 ++-
 gdb/cp-valprint.c                             |  3 ++-
 gdb/cris-linux-tdep.c                         |  3 ++-
 gdb/cris-tdep.c                               |  3 ++-
 gdb/csky-linux-tdep.c                         |  3 ++-
 gdb/csky-tdep.c                               |  3 ++-
 gdb/ctfread.c                                 |  3 ++-
 gdb/d-lang.c                                  |  3 ++-
 gdb/darwin-nat-info.c                         |  3 ++-
 gdb/darwin-nat.c                              |  1 +
 gdb/dbxread.c                                 |  3 ++-
 gdb/dcache.c                                  |  3 ++-
 gdb/disasm-selftests.c                        |  3 ++-
 gdb/disasm.c                                  |  3 ++-
 gdb/dtrace-probe.c                            |  3 ++-
 gdb/dummy-frame.c                             |  3 ++-
 gdb/dwarf-index-cache.c                       |  1 +
 gdb/dwarf-index-write.c                       |  1 +
 gdb/dwarf2-frame-tailcall.c                   |  3 ++-
 gdb/dwarf2-frame.c                            |  3 ++-
 gdb/dwarf2expr.c                              |  3 ++-
 gdb/dwarf2loc.c                               |  3 ++-
 gdb/dwarf2read.c                              |  3 ++-
 gdb/elfread.c                                 |  3 ++-
 gdb/exec.c                                    |  3 ++-
 gdb/extension.c                               |  3 ++-
 gdb/f-lang.c                                  |  3 ++-
 gdb/f-valprint.c                              |  3 ++-
 gdb/fbsd-nat.c                                |  3 ++-
 gdb/fbsd-tdep.c                               |  3 ++-
 gdb/filesystem.c                              |  3 ++-
 gdb/findcmd.c                                 |  3 ++-
 gdb/findvar.c                                 |  3 ++-
 gdb/fork-child.c                              |  3 ++-
 gdb/frame-base.c                              |  3 ++-
 gdb/frame-unwind.c                            |  3 ++-
 gdb/frame.c                                   |  3 ++-
 gdb/frv-linux-tdep.c                          |  3 ++-
 gdb/frv-tdep.c                                |  3 ++-
 gdb/ft32-tdep.c                               |  3 ++-
 gdb/gcore.c                                   |  3 ++-
 gdb/gdb-demangle.c                            |  3 ++-
 gdb/gdb_bfd.c                                 |  3 ++-
 gdb/gdbarch-selftests.c                       |  3 ++-
 gdb/gdbarch.c                                 |  3 ++-
 gdb/gdbserver/configure                       |  3 ++-
 gdb/gdbserver/hostio-errno.c                  |  3 +++
 gdb/gdbserver/inferiors.c                     |  1 +
 gdb/gdbserver/linux-x86-low.c                 | 26 +++++++++----------
 gdb/gdbserver/tracepoint.c                    | 20 ++++++++++++++
 gdb/gdbserver/tracepoint.h                    |  2 +-
 gdb/gdbtypes.c                                |  3 ++-
 gdb/gnu-nat.c                                 |  3 ++-
 gdb/gnu-v2-abi.c                              |  3 ++-
 gdb/gnu-v3-abi.c                              |  3 ++-
 gdb/go-lang.c                                 |  3 ++-
 gdb/go32-nat.c                                |  3 ++-
 gdb/guile/guile.c                             |  3 ++-
 gdb/h8300-tdep.c                              |  3 ++-
 gdb/hppa-linux-nat.c                          |  3 ++-
 gdb/hppa-linux-tdep.c                         |  3 ++-
 gdb/hppa-nbsd-nat.c                           |  3 ++-
 gdb/hppa-nbsd-tdep.c                          |  3 ++-
 gdb/hppa-obsd-nat.c                           |  3 ++-
 gdb/hppa-obsd-tdep.c                          |  3 ++-
 gdb/hppa-tdep.c                               |  3 ++-
 gdb/i386-bsd-nat.c                            |  3 ++-
 gdb/i386-cygwin-tdep.c                        |  3 ++-
 gdb/i386-darwin-nat.c                         |  3 ++-
 gdb/i386-darwin-tdep.c                        |  3 ++-
 gdb/i386-dicos-tdep.c                         |  3 ++-
 gdb/i386-fbsd-nat.c                           |  3 ++-
 gdb/i386-fbsd-tdep.c                          |  3 ++-
 gdb/i386-gnu-nat.c                            |  3 ++-
 gdb/i386-gnu-tdep.c                           |  3 ++-
 gdb/i386-go32-tdep.c                          |  1 +
 gdb/i386-linux-nat.c                          |  3 ++-
 gdb/i386-linux-tdep.c                         |  3 ++-
 gdb/i386-nbsd-nat.c                           |  3 ++-
 gdb/i386-nbsd-tdep.c                          |  3 ++-
 gdb/i386-nto-tdep.c                           |  3 ++-
 gdb/i386-obsd-nat.c                           |  3 ++-
 gdb/i386-obsd-tdep.c                          |  3 ++-
 gdb/i386-sol2-nat.c                           |  3 ++-
 gdb/i386-sol2-tdep.c                          |  3 ++-
 gdb/i386-tdep.c                               |  3 ++-
 gdb/i386-windows-nat.c                        |  3 ++-
 gdb/ia64-libunwind-tdep.c                     |  3 ++-
 gdb/ia64-linux-nat.c                          |  3 ++-
 gdb/ia64-linux-tdep.c                         |  3 ++-
 gdb/ia64-tdep.c                               |  3 ++-
 gdb/ia64-vms-tdep.c                           |  3 ++-
 gdb/infcall.c                                 |  3 ++-
 gdb/infcmd.c                                  |  3 ++-
 gdb/inflow.c                                  |  3 ++-
 gdb/infrun.c                                  |  3 ++-
 gdb/interps.c                                 |  3 ++-
 gdb/iq2000-tdep.c                             |  3 ++-
 gdb/jit.c                                     |  3 ++-
 gdb/language.c                                |  3 ++-
 gdb/linux-fork.c                              |  3 ++-
 gdb/linux-nat.c                               |  3 ++-
 gdb/linux-tdep.c                              |  3 ++-
 gdb/linux-thread-db.c                         |  3 ++-
 gdb/lm32-tdep.c                               |  3 ++-
 gdb/m2-lang.c                                 |  3 ++-
 gdb/m32c-tdep.c                               |  3 ++-
 gdb/m32r-linux-nat.c                          |  3 ++-
 gdb/m32r-linux-tdep.c                         |  3 ++-
 gdb/m32r-tdep.c                               |  3 ++-
 gdb/m68hc11-tdep.c                            |  3 ++-
 gdb/m68k-bsd-nat.c                            |  3 ++-
 gdb/m68k-bsd-tdep.c                           |  3 ++-
 gdb/m68k-linux-nat.c                          |  3 ++-
 gdb/m68k-linux-tdep.c                         |  3 ++-
 gdb/m68k-tdep.c                               |  3 ++-
 gdb/machoread.c                               |  3 ++-
 gdb/macrocmd.c                                |  3 ++-
 gdb/macroscope.c                              |  3 ++-
 gdb/maint-test-options.c                      |  1 +
 gdb/maint-test-settings.c                     |  3 ++-
 gdb/maint.c                                   |  3 ++-
 gdb/mdebugread.c                              |  3 ++-
 gdb/memattr.c                                 |  3 ++-
 gdb/mep-tdep.c                                |  3 ++-
 gdb/mi/mi-cmd-env.c                           |  3 ++-
 gdb/mi/mi-cmds.c                              |  3 ++-
 gdb/mi/mi-interp.c                            |  3 ++-
 gdb/mi/mi-main.c                              |  3 ++-
 gdb/microblaze-linux-tdep.c                   |  3 ++-
 gdb/microblaze-tdep.c                         |  3 ++-
 gdb/mips-fbsd-nat.c                           |  3 ++-
 gdb/mips-fbsd-tdep.c                          |  3 ++-
 gdb/mips-linux-nat.c                          |  3 ++-
 gdb/mips-linux-tdep.c                         |  3 ++-
 gdb/mips-nbsd-nat.c                           |  3 ++-
 gdb/mips-nbsd-tdep.c                          |  3 ++-
 gdb/mips-sde-tdep.c                           |  3 ++-
 gdb/mips-tdep.c                               |  3 ++-
 gdb/mips64-obsd-nat.c                         |  3 ++-
 gdb/mips64-obsd-tdep.c                        |  3 ++-
 gdb/mipsread.c                                |  3 ++-
 gdb/mn10300-linux-tdep.c                      |  3 ++-
 gdb/mn10300-tdep.c                            |  3 ++-
 gdb/moxie-tdep.c                              |  3 ++-
 gdb/msp430-tdep.c                             |  3 ++-
 gdb/nds32-tdep.c                              |  3 ++-
 gdb/nios2-linux-tdep.c                        |  3 ++-
 gdb/nios2-tdep.c                              |  3 ++-
 gdb/nto-procfs.c                              |  3 ++-
 gdb/objc-lang.c                               |  3 ++-
 gdb/observable.c                              |  3 ++-
 gdb/opencl-lang.c                             |  3 ++-
 gdb/or1k-linux-tdep.c                         |  3 ++-
 gdb/or1k-tdep.c                               |  3 ++-
 gdb/osabi.c                                   |  3 ++-
 gdb/osdata.c                                  |  3 ++-
 gdb/p-valprint.c                              |  3 ++-
 gdb/parse.c                                   |  3 ++-
 gdb/ppc-fbsd-nat.c                            |  3 ++-
 gdb/ppc-fbsd-tdep.c                           |  3 ++-
 gdb/ppc-linux-nat.c                           |  3 ++-
 gdb/ppc-linux-tdep.c                          |  3 ++-
 gdb/ppc-nbsd-nat.c                            |  3 ++-
 gdb/ppc-nbsd-tdep.c                           |  3 ++-
 gdb/ppc-obsd-nat.c                            |  3 ++-
 gdb/ppc-obsd-tdep.c                           |  3 ++-
 gdb/printcmd.c                                |  3 ++-
 gdb/probe.c                                   |  3 ++-
 gdb/proc-api.c                                |  3 ++-
 gdb/proc-events.c                             |  3 ++-
 gdb/proc-service.c                            |  3 ++-
 gdb/procfs.c                                  |  3 ++-
 gdb/producer.c                                |  1 +
 gdb/psymtab.c                                 |  3 ++-
 gdb/python/python.c                           |  4 ++-
 gdb/ravenscar-thread.c                        |  1 +
 gdb/record-btrace.c                           |  3 ++-
 gdb/record-full.c                             |  3 ++-
 gdb/record.c                                  |  3 ++-
 gdb/regcache-dump.c                           |  3 ++-
 gdb/regcache.c                                |  3 ++-
 gdb/reggroups.c                               |  3 ++-
 gdb/remote-notif.c                            |  3 ++-
 gdb/remote-sim.c                              |  3 ++-
 gdb/remote.c                                  |  3 ++-
 gdb/reverse.c                                 |  3 ++-
 gdb/riscv-fbsd-nat.c                          |  3 ++-
 gdb/riscv-fbsd-tdep.c                         |  3 ++-
 gdb/riscv-linux-nat.c                         |  3 ++-
 gdb/riscv-linux-tdep.c                        |  3 ++-
 gdb/riscv-tdep.c                              |  3 ++-
 gdb/rl78-tdep.c                               |  3 ++-
 gdb/rs6000-aix-tdep.c                         |  3 ++-
 gdb/rs6000-lynx178-tdep.c                     |  3 ++-
 gdb/rs6000-nat.c                              |  3 ++-
 gdb/rs6000-tdep.c                             |  3 ++-
 gdb/run-on-main-thread.c                      |  1 +
 gdb/rust-exp.y                                |  3 ++-
 gdb/rx-tdep.c                                 |  3 ++-
 gdb/s12z-tdep.c                               |  3 ++-
 gdb/s390-linux-nat.c                          |  3 ++-
 gdb/s390-linux-tdep.c                         |  3 ++-
 gdb/s390-tdep.c                               |  3 ++-
 gdb/score-tdep.c                              |  3 ++-
 gdb/ser-go32.c                                |  3 ++-
 gdb/ser-mingw.c                               |  3 ++-
 gdb/ser-pipe.c                                |  3 ++-
 gdb/ser-tcp.c                                 |  3 ++-
 gdb/ser-uds.c                                 |  3 ++-
 gdb/ser-unix.c                                |  3 ++-
 gdb/serial.c                                  |  3 ++-
 gdb/sh-linux-tdep.c                           |  3 ++-
 gdb/sh-nbsd-nat.c                             |  3 ++-
 gdb/sh-nbsd-tdep.c                            |  3 ++-
 gdb/sh-tdep.c                                 |  3 ++-
 gdb/skip.c                                    |  3 ++-
 gdb/sol-thread.c                              |  3 ++-
 gdb/solib-aix.c                               |  3 ++-
 gdb/solib-darwin.c                            |  3 ++-
 gdb/solib-dsbt.c                              |  3 ++-
 gdb/solib-frv.c                               |  3 ++-
 gdb/solib-svr4.c                              |  3 ++-
 gdb/solib-target.c                            |  3 ++-
 gdb/solib.c                                   |  3 ++-
 gdb/source-cache.c                            |  1 +
 gdb/source.c                                  |  3 ++-
 gdb/sparc-linux-nat.c                         |  3 ++-
 gdb/sparc-linux-tdep.c                        |  3 ++-
 gdb/sparc-nat.c                               |  3 ++-
 gdb/sparc-nbsd-nat.c                          |  3 ++-
 gdb/sparc-nbsd-tdep.c                         |  3 ++-
 gdb/sparc-obsd-tdep.c                         |  3 ++-
 gdb/sparc-sol2-tdep.c                         |  3 ++-
 gdb/sparc-tdep.c                              |  3 ++-
 gdb/sparc64-fbsd-nat.c                        |  3 ++-
 gdb/sparc64-fbsd-tdep.c                       |  3 ++-
 gdb/sparc64-linux-nat.c                       |  3 ++-
 gdb/sparc64-linux-tdep.c                      |  3 ++-
 gdb/sparc64-nat.c                             |  3 ++-
 gdb/sparc64-nbsd-nat.c                        |  3 ++-
 gdb/sparc64-nbsd-tdep.c                       |  3 ++-
 gdb/sparc64-obsd-nat.c                        |  3 ++-
 gdb/sparc64-obsd-tdep.c                       |  3 ++-
 gdb/sparc64-sol2-tdep.c                       |  3 ++-
 gdb/sparc64-tdep.c                            |  3 ++-
 gdb/stabsread.c                               |  3 ++-
 gdb/stack.c                                   |  3 ++-
 gdb/stap-probe.c                              |  3 ++-
 gdb/std-regs.c                                |  3 ++-
 gdb/symfile-debug.c                           |  3 ++-
 gdb/symfile-mem.c                             |  3 ++-
 gdb/symfile.c                                 |  3 ++-
 gdb/symmisc.c                                 |  3 ++-
 gdb/symtab.c                                  |  3 ++-
 gdb/target-dcache.c                           |  3 ++-
 gdb/target-descriptions.c                     |  3 ++-
 gdb/thread.c                                  |  3 ++-
 gdb/tic6x-linux-tdep.c                        |  3 ++-
 gdb/tic6x-tdep.c                              |  3 ++-
 gdb/tilegx-linux-nat.c                        |  3 ++-
 gdb/tilegx-linux-tdep.c                       |  3 ++-
 gdb/tilegx-tdep.c                             |  3 ++-
 gdb/tracectf.c                                |  3 ++-
 gdb/tracefile-tfile.c                         |  3 ++-
 gdb/tracefile.c                               |  3 ++-
 gdb/tracepoint.c                              |  3 ++-
 gdb/tui/tui-hooks.c                           |  3 ++-
 gdb/tui/tui-interp.c                          |  3 ++-
 gdb/tui/tui-layout.c                          |  3 ++-
 gdb/tui/tui-regs.c                            |  3 ++-
 gdb/tui/tui-stack.c                           |  3 ++-
 gdb/tui/tui-win.c                             |  3 ++-
 gdb/tui/tui.c                                 |  3 ++-
 gdb/typeprint.c                               |  3 ++-
 gdb/ui-style.c                                |  1 +
 gdb/unittests/array-view-selftests.c          |  1 +
 gdb/unittests/child-path-selftests.c          |  1 +
 gdb/unittests/cli-utils-selftests.c           |  1 +
 gdb/unittests/common-utils-selftests.c        |  1 +
 gdb/unittests/copy_bitwise-selftests.c        |  1 +
 gdb/unittests/environ-selftests.c             |  1 +
 gdb/unittests/filtered_iterator-selftests.c   |  1 +
 gdb/unittests/format_pieces-selftests.c       |  1 +
 gdb/unittests/function-view-selftests.c       |  1 +
 gdb/unittests/help-doc-selftests.c            |  1 +
 gdb/unittests/lookup_name_info-selftests.c    |  1 +
 gdb/unittests/main-thread-selftests.c         |  1 +
 gdb/unittests/memory-map-selftests.c          |  1 +
 gdb/unittests/memrange-selftests.c            |  1 +
 gdb/unittests/mkdir-recursive-selftests.c     |  1 +
 gdb/unittests/observable-selftests.c          |  1 +
 gdb/unittests/offset-type-selftests.c         |  1 +
 gdb/unittests/optional-selftests.c            |  1 +
 .../parse-connection-spec-selftests.c         |  1 +
 gdb/unittests/rsp-low-selftests.c             |  1 +
 gdb/unittests/scoped_fd-selftests.c           |  1 +
 gdb/unittests/scoped_mmap-selftests.c         |  1 +
 gdb/unittests/scoped_restore-selftests.c      |  1 +
 gdb/unittests/string_view-selftests.c         |  1 +
 gdb/unittests/style-selftests.c               |  1 +
 gdb/unittests/tracepoint-selftests.c          |  1 +
 gdb/unittests/tui-selftests.c                 |  1 +
 gdb/unittests/unpack-selftests.c              |  1 +
 gdb/unittests/utils-selftests.c               |  1 +
 gdb/unittests/vec-utils-selftests.c           |  1 +
 gdb/unittests/xml-utils-selftests.c           |  1 +
 gdb/user-regs.c                               |  3 ++-
 gdb/utils.c                                   |  3 ++-
 gdb/v850-tdep.c                               |  3 ++-
 gdb/valops.c                                  |  3 ++-
 gdb/valprint.c                                |  3 ++-
 gdb/value.c                                   |  3 ++-
 gdb/varobj.c                                  |  3 ++-
 gdb/vax-bsd-nat.c                             |  3 ++-
 gdb/vax-nbsd-tdep.c                           |  3 ++-
 gdb/vax-tdep.c                                |  3 ++-
 gdb/warning.m4                                |  3 ++-
 gdb/windows-nat.c                             |  9 ++++---
 gdb/windows-tdep.c                            |  3 ++-
 gdb/x86-bsd-nat.c                             |  1 +
 gdb/x86-linux-nat.c                           |  1 +
 gdb/xcoffread.c                               |  3 ++-
 gdb/xml-support.c                             |  4 ++-
 gdb/xstormy16-tdep.c                          |  3 ++-
 gdb/xtensa-linux-nat.c                        |  3 ++-
 gdb/xtensa-linux-tdep.c                       |  3 ++-
 gdb/xtensa-tdep.c                             |  3 ++-
 405 files changed, 799 insertions(+), 371 deletions(-)

-- 
2.24.1

Comments

Tom Tromey Jan. 11, 2020, 4:54 p.m. | #1
>>>>> "Simon" == Simon Marchi <simon.marchi@efficios.com> writes:


Simon> This is v2 of:
Simon>   https://sourceware.org/ml/gdb-patches/2019-11/msg00805.html

Simon> Although a few patches of the original series were merged, since they
Simon> were valid fixes in any case.

I read through the series.

I think this warning would be good to have, because it can help detect
bugs.  It's maybe mildly unfortunate that we have to have the first
patch, but at the same time it's not that much noise in the end -- just
an extra line (typically) near the end of a file.  The other patches all
seem desirable on their own terms.

So, I think you should check it in.

thanks,
Tom
Simon Marchi Jan. 12, 2020, 2:48 a.m. | #2
On 2020-01-11 11:54 a.m., Tom Tromey wrote:
>>>>>> "Simon" == Simon Marchi <simon.marchi@efficios.com> writes:

> 

> Simon> This is v2 of:

> Simon>   https://sourceware.org/ml/gdb-patches/2019-11/msg00805.html

> 

> Simon> Although a few patches of the original series were merged, since they

> Simon> were valid fixes in any case.

> 

> I read through the series.

> 

> I think this warning would be good to have, because it can help detect

> bugs.  It's maybe mildly unfortunate that we have to have the first

> patch, but at the same time it's not that much noise in the end -- just

> an extra line (typically) near the end of a file.  The other patches all

> seem desirable on their own terms.

> 

> So, I think you should check it in.


Thanks again for the tip to finish the last patch.  This is v2, and v1 was
sent a while ago, so I figure that if somebody was against it, they would
have spoken up by now.  So I'll rebase and push it.  Sorry in advance for
the breakages on the configs I am not able to build easily.

Simon
Joel Brobecker Jan. 12, 2020, 7:06 a.m. | #3
> I read through the series.

> 

> I think this warning would be good to have, because it can help detect

> bugs.


A small bonus is that this warning should also help us detect functions
that could be declared static. Not a huge deal in terms of code
correctness, but a valuable piece of information, when one is
reading through the code...

> It's maybe mildly unfortunate that we have to have the first

> patch, but at the same time it's not that much noise in the end -- just

> an extra line (typically) near the end of a file.  The other patches all

> seem desirable on their own terms.

> 

> So, I think you should check it in.


+1

-- 
Joel
Simon Marchi Jan. 12, 2020, 8:22 p.m. | #4
On 2020-01-10 5:00 p.m., Simon Marchi wrote:
> This is v2 of:

> 

>   https://sourceware.org/ml/gdb-patches/2019-11/msg00805.html

> 

> Although a few patches of the original series were merged, since they

> were valid fixes in any case.

> 

> I have re-generated the configure script for gdbserver, which I had

> forgotten in v1, and it of course unearthed some more issues.

> 

> I have build-tested the series with gcc 7.4.0 and clang 9.


As I tried building gdbserver with a few cross compilers, I found another
build issue, with code generated by regdat.sh.  The following patch addresses
it.  It should not be too controversial, but I wanted to run it by you first.


From ff6633d14065273791b5b70266f4afceba22aeec Mon Sep 17 00:00:00 2001
From: Simon Marchi <simon.marchi@polymtl.ca>

Date: Sun, 12 Jan 2020 13:09:46 -0500
Subject: [PATCH] gdb: make regformats output a declaration for the init
 function

When compiling gdbserver for an architecture that uses the regdat.sh
script (such as m68k) and the -Wmissing-declarations compiler flag, I
get:

  REGDAT reg-m68k-generated.c
  CXX    reg-m68k.o
reg-m68k-generated.c:30:1: error: no previous declaration for 'void init_registers_m68k()' [-Werror=missing-declarations]
   30 | init_registers_m68k (void)
      | ^~~~~~~~~~~~~~~~~~~

The same happens with other architectures, such as s390, but I'll be
using 68k as an example.

The init_registers_m68k function is defined in reg-m68k-generated.c,
which is produced by the regformats/regdat.sh script.  This script reads
the regformats/reg-m68k.dat file, containing a register description, and
produces C code that creates a corresponding target description at
runtime.

The init_registers_m68k function is invoked at initialization time in
linux-m68k-low.c.  The function must therefore be non-static, but does
not have a declaration at the moment.

The real clean way of fixing this would be to make regdat.sh generate a
.h file (in addition to the .c file) with declarations for whatever is
in the .c file.  The generated .c file would include the .h file, and
therefore the definition would have a corresponding declaration.  The
linux-m68k-low.c file would also include this .h file, instead of having
its own declaration of init_registers_m68k, like it does now.

However, this would be a quite big change for not much gain.  As far as
I understand, some common architectures (i386, x86-64, ARM, AArch64)
have been moved to dynamically building target descriptions based on
features (the linux-*-tdesc.c files in gdbserver) and don't use
regdat.sh anymore.  Logically (and given infinite development
resources), the other architectures would be migrated to this system too
and the regdat.sh script would be dropped.  A new architecture would
probably not use regdat.sh either.  So I therefore propose this simpler
patch instead, which just adds a local declaration in the generated
file.

gdb/ChangeLog:

	* regformats/regdat.sh: Generate declaration for init function.
---
 gdb/regformats/regdat.sh | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/gdb/regformats/regdat.sh b/gdb/regformats/regdat.sh
index 1839a881213c..a40f2336484f 100755
--- a/gdb/regformats/regdat.sh
+++ b/gdb/regformats/regdat.sh
@@ -127,6 +127,10 @@ do

     echo "const struct target_desc *tdesc_${name};"
     echo ""
+
+    # This is necessary for -Wmissing-declarations.
+    echo "void init_registers_${name} (void);"
+
     echo "void"
     echo "init_registers_${name} (void)"
     echo "{"
-- 
2.24.1
Tom Tromey Jan. 13, 2020, 5:33 p.m. | #5
>>>>> "Simon" == Simon Marchi <simark@simark.ca> writes:


Simon> As I tried building gdbserver with a few cross compilers, I found another
Simon> build issue, with code generated by regdat.sh.  The following patch addresses
Simon> it.  It should not be too controversial, but I wanted to run it by you first.

Simon> gdb/ChangeLog:

Simon> 	* regformats/regdat.sh: Generate declaration for init function.

This is fine by me.  I agree with your analysis in the commit message.

Tom
Simon Marchi Jan. 13, 2020, 7 p.m. | #6
On 2020-01-13 12:33 p.m., Tom Tromey wrote:
>>>>>> "Simon" == Simon Marchi <simark@simark.ca> writes:

> 

> Simon> As I tried building gdbserver with a few cross compilers, I found another

> Simon> build issue, with code generated by regdat.sh.  The following patch addresses

> Simon> it.  It should not be too controversial, but I wanted to run it by you first.

> 

> Simon> gdb/ChangeLog:

> 

> Simon> 	* regformats/regdat.sh: Generate declaration for init function.

> 

> This is fine by me.  I agree with your analysis in the commit message.


Thanks, I pushed this patch.

Simon
Simon Marchi Jan. 13, 2020, 7:10 p.m. | #7
On 2020-01-11 9:48 p.m., Simon Marchi wrote:
> Thanks again for the tip to finish the last patch.  This is v2, and v1 was

> sent a while ago, so I figure that if somebody was against it, they would

> have spoken up by now.  So I'll rebase and push it.  Sorry in advance for

> the breakages on the configs I am not able to build easily.


I have now pushed this series, after finding and fixing a few more problems.

Simon