mirror of
https://github.com/gcc-mirror/gcc.git
synced 2024-11-21 13:40:47 +00:00
50332a4fdd
I've tried to build stage3 with -Wleading-whitespace=blanks -Wtrailing-whitespace=blank -Wno-error=leading-whitespace=blanks -Wno-error=trailing-whitespace=blank added to STRICT_WARN and that expectably resulted in about 2744 unique trailing whitespace warnings and 124837 leading whitespace warnings when excluding *.md files (which obviously is in big part a generator issue). Others from that are generator related, I think those need to be solved later. The following patch just fixes up the easy case (trailing whitespace), which could be easily automated: for i in `find . -name \*.h -o -name \*.cc -o -name \*.c | xargs grep -l '[ ]$' | grep -v testsuite/`; do sed -i -e 's/[ ]*$//' $i; done I've excluded files which I knew are obviously generated or go FE. Is there anything else we'd want to avoid the changes? Due to patch size, I've split it between gcc/ part (this patch) and rest (include/, libiberty/, libgcc/, libcpp/, libstdc++-v3/). 2024-10-24 Jakub Jelinek <jakub@redhat.com> gcc/ * lra-assigns.cc: Remove trailing whitespace. * symtab.cc: Likewise. * stmt.cc: Likewise. * cgraphbuild.cc: Likewise. * cfgcleanup.cc: Likewise. * loop-init.cc: Likewise. * df-problems.cc: Likewise. * diagnostic-macro-unwinding.cc: Likewise. * langhooks.h: Likewise. * except.cc: Likewise. * tree-vect-loop.cc: Likewise. * coverage.cc: Likewise. * hash-table.cc: Likewise. * ggc-page.cc: Likewise. * gimple-ssa-strength-reduction.cc: Likewise. * tree-parloops.cc: Likewise. * internal-fn.cc: Likewise. * ipa-split.cc: Likewise. * calls.cc: Likewise. * reorg.cc: Likewise. * sbitmap.h: Likewise. * omp-offload.cc: Likewise. * cfgrtl.cc: Likewise. * reginfo.cc: Likewise. * gengtype.h: Likewise. * omp-general.h: Likewise. * ipa-comdats.cc: Likewise. * gimple-range-edge.h: Likewise. * tree-ssa-structalias.cc: Likewise. * target.def: Likewise. * basic-block.h: Likewise. * graphite-isl-ast-to-gimple.cc: Likewise. * auto-profile.cc: Likewise. * optabs.cc: Likewise. * gengtype-lex.l: Likewise. * optabs.def: Likewise. * ira-build.cc: Likewise. * ira.cc: Likewise. * function.h: Likewise. * tree-ssa-propagate.cc: Likewise. * gcov-io.cc: Likewise. * builtin-types.def: Likewise. * ddg.cc: Likewise. * lra-spills.cc: Likewise. * cfg.cc: Likewise. * bitmap.cc: Likewise. * gimple-range-gori.h: Likewise. * tree-ssa-loop-im.cc: Likewise. * cfghooks.h: Likewise. * genmatch.cc: Likewise. * explow.cc: Likewise. * lto-streamer-in.cc: Likewise. * graphite-scop-detection.cc: Likewise. * ipa-prop.cc: Likewise. * gcc.cc: Likewise. * vec.h: Likewise. * cfgexpand.cc: Likewise. * config/alpha/vms.h: Likewise. * config/alpha/alpha.cc: Likewise. * config/alpha/driver-alpha.cc: Likewise. * config/alpha/elf.h: Likewise. * config/iq2000/iq2000.h: Likewise. * config/iq2000/iq2000.cc: Likewise. * config/pa/pa-64.h: Likewise. * config/pa/som.h: Likewise. * config/pa/pa.cc: Likewise. * config/pa/pa.h: Likewise. * config/pa/pa32-regs.h: Likewise. * config/c6x/c6x.cc: Likewise. * config/openbsd-stdint.h: Likewise. * config/elfos.h: Likewise. * config/lm32/lm32.cc: Likewise. * config/lm32/lm32.h: Likewise. * config/lm32/lm32-protos.h: Likewise. * config/darwin-c.cc: Likewise. * config/rx/rx.cc: Likewise. * config/host-darwin.h: Likewise. * config/netbsd.h: Likewise. * config/ia64/ia64.cc: Likewise. * config/ia64/freebsd.h: Likewise. * config/avr/avr-c.cc: Likewise. * config/avr/avr.cc: Likewise. * config/avr/avr-arch.h: Likewise. * config/avr/avr.h: Likewise. * config/avr/stdfix.h: Likewise. * config/avr/gen-avr-mmcu-specs.cc: Likewise. * config/avr/avr-log.cc: Likewise. * config/avr/elf.h: Likewise. * config/avr/gen-avr-mmcu-texi.cc: Likewise. * config/avr/avr-devices.cc: Likewise. * config/nvptx/nvptx.cc: Likewise. * config/vx-common.h: Likewise. * config/sol2.cc: Likewise. * config/rl78/rl78.cc: Likewise. * config/cris/cris.cc: Likewise. * config/arm/symbian.h: Likewise. * config/arm/unknown-elf.h: Likewise. * config/arm/linux-eabi.h: Likewise. * config/arm/arm.cc: Likewise. * config/arm/arm-mve-builtins.h: Likewise. * config/arm/bpabi.h: Likewise. * config/arm/vxworks.h: Likewise. * config/arm/arm.h: Likewise. * config/arm/aout.h: Likewise. * config/arm/elf.h: Likewise. * config/host-linux.cc: Likewise. * config/sh/sh_treg_combine.cc: Likewise. * config/sh/vxworks.h: Likewise. * config/sh/elf.h: Likewise. * config/sh/netbsd-elf.h: Likewise. * config/sh/sh.cc: Likewise. * config/sh/embed-elf.h: Likewise. * config/sh/sh.h: Likewise. * config/darwin-driver.cc: Likewise. * config/m32c/m32c.cc: Likewise. * config/frv/frv.cc: Likewise. * config/openbsd.h: Likewise. * config/aarch64/aarch64-protos.h: Likewise. * config/aarch64/aarch64-builtins.cc: Likewise. * config/aarch64/aarch64-cost-tables.h: Likewise. * config/aarch64/aarch64.cc: Likewise. * config/bfin/bfin.cc: Likewise. * config/bfin/bfin.h: Likewise. * config/bfin/bfin-protos.h: Likewise. * config/i386/gmm_malloc.h: Likewise. * config/i386/djgpp.h: Likewise. * config/i386/sol2.h: Likewise. * config/i386/stringop.def: Likewise. * config/i386/i386-features.cc: Likewise. * config/i386/openbsdelf.h: Likewise. * config/i386/cpuid.h: Likewise. * config/i386/i386.h: Likewise. * config/i386/smmintrin.h: Likewise. * config/i386/avx10_2-512convertintrin.h: Likewise. * config/i386/i386-options.cc: Likewise. * config/i386/i386-opts.h: Likewise. * config/i386/i386-expand.cc: Likewise. * config/i386/avx512dqintrin.h: Likewise. * config/i386/wmmintrin.h: Likewise. * config/i386/gnu-user.h: Likewise. * config/i386/host-mingw32.cc: Likewise. * config/i386/avx10_2bf16intrin.h: Likewise. * config/i386/cygwin.h: Likewise. * config/i386/driver-i386.cc: Likewise. * config/i386/biarch64.h: Likewise. * config/i386/host-cygwin.cc: Likewise. * config/i386/cygming.h: Likewise. * config/i386/i386-builtins.cc: Likewise. * config/i386/avx10_2convertintrin.h: Likewise. * config/i386/i386.cc: Likewise. * config/i386/gas.h: Likewise. * config/i386/freebsd.h: Likewise. * config/mingw/winnt-cxx.cc: Likewise. * config/mingw/winnt.cc: Likewise. * config/h8300/h8300.cc: Likewise. * config/host-solaris.cc: Likewise. * config/m32r/m32r.h: Likewise. * config/m32r/m32r.cc: Likewise. * config/darwin.h: Likewise. * config/sparc/linux64.h: Likewise. * config/sparc/sparc-protos.h: Likewise. * config/sparc/sysv4.h: Likewise. * config/sparc/sparc.h: Likewise. * config/sparc/linux.h: Likewise. * config/sparc/freebsd.h: Likewise. * config/sparc/sparc.cc: Likewise. * config/gcn/gcn-run.cc: Likewise. * config/gcn/gcn.cc: Likewise. * config/gcn/gcn-tree.cc: Likewise. * config/kopensolaris-gnu.h: Likewise. * config/nios2/nios2.h: Likewise. * config/nios2/elf.h: Likewise. * config/nios2/nios2.cc: Likewise. * config/host-netbsd.cc: Likewise. * config/rtems.h: Likewise. * config/pdp11/pdp11.cc: Likewise. * config/pdp11/pdp11.h: Likewise. * config/mn10300/mn10300.cc: Likewise. * config/mn10300/linux.h: Likewise. * config/moxie/moxie.h: Likewise. * config/moxie/moxie.cc: Likewise. * config/rs6000/aix71.h: Likewise. * config/rs6000/vec_types.h: Likewise. * config/rs6000/xcoff.h: Likewise. * config/rs6000/rs6000.cc: Likewise. * config/rs6000/rs6000-internal.h: Likewise. * config/rs6000/rs6000-p8swap.cc: Likewise. * config/rs6000/rs6000-c.cc: Likewise. * config/rs6000/aix.h: Likewise. * config/rs6000/rs6000-logue.cc: Likewise. * config/rs6000/rs6000-string.cc: Likewise. * config/rs6000/rs6000-call.cc: Likewise. * config/rs6000/ppu_intrinsics.h: Likewise. * config/rs6000/altivec.h: Likewise. * config/rs6000/darwin.h: Likewise. * config/rs6000/host-darwin.cc: Likewise. * config/rs6000/freebsd64.h: Likewise. * config/rs6000/spu2vmx.h: Likewise. * config/rs6000/linux.h: Likewise. * config/rs6000/si2vmx.h: Likewise. * config/rs6000/driver-rs6000.cc: Likewise. * config/rs6000/freebsd.h: Likewise. * config/vxworksae.h: Likewise. * config/mips/frame-header-opt.cc: Likewise. * config/mips/mips.h: Likewise. * config/mips/mips.cc: Likewise. * config/mips/sde.h: Likewise. * config/darwin-protos.h: Likewise. * config/mcore/mcore-elf.h: Likewise. * config/mcore/mcore.h: Likewise. * config/mcore/mcore.cc: Likewise. * config/epiphany/epiphany.cc: Likewise. * config/fr30/fr30.h: Likewise. * config/fr30/fr30.cc: Likewise. * config/riscv/riscv-vector-builtins-shapes.cc: Likewise. * config/riscv/riscv-vector-builtins-bases.cc: Likewise. * config/visium/visium.h: Likewise. * config/mmix/mmix.cc: Likewise. * config/v850/v850.cc: Likewise. * config/v850/v850-c.cc: Likewise. * config/v850/v850.h: Likewise. * config/stormy16/stormy16.cc: Likewise. * config/stormy16/stormy16-protos.h: Likewise. * config/stormy16/stormy16.h: Likewise. * config/arc/arc.cc: Likewise. * config/vxworks.cc: Likewise. * config/microblaze/microblaze-c.cc: Likewise. * config/microblaze/microblaze-protos.h: Likewise. * config/microblaze/microblaze.h: Likewise. * config/microblaze/microblaze.cc: Likewise. * config/freebsd-spec.h: Likewise. * config/m68k/m68kelf.h: Likewise. * config/m68k/m68k.cc: Likewise. * config/m68k/netbsd-elf.h: Likewise. * config/m68k/linux.h: Likewise. * config/freebsd.h: Likewise. * config/host-openbsd.cc: Likewise. * regcprop.cc: Likewise. * dumpfile.cc: Likewise. * combine.cc: Likewise. * tree-ssa-forwprop.cc: Likewise. * ipa-profile.cc: Likewise. * hw-doloop.cc: Likewise. * opts.cc: Likewise. * gcc-ar.cc: Likewise. * tree-cfg.cc: Likewise. * incpath.cc: Likewise. * tree-ssa-sccvn.cc: Likewise. * function.cc: Likewise. * genattrtab.cc: Likewise. * rtl.def: Likewise. * genchecksum.cc: Likewise. * profile.cc: Likewise. * df-core.cc: Likewise. * tree-pretty-print.cc: Likewise. * tree.h: Likewise. * plugin.cc: Likewise. * tree-ssa-loop-ch.cc: Likewise. * emit-rtl.cc: Likewise. * haifa-sched.cc: Likewise. * gimple-range-edge.cc: Likewise. * range-op.cc: Likewise. * tree-ssa-ccp.cc: Likewise. * dwarf2cfi.cc: Likewise. * recog.cc: Likewise. * vtable-verify.cc: Likewise. * system.h: Likewise. * regrename.cc: Likewise. * tree-ssa-dom.cc: Likewise. * loop-unroll.cc: Likewise. * lra-constraints.cc: Likewise. * pretty-print.cc: Likewise. * ifcvt.cc: Likewise. * ipa.cc: Likewise. * alloc-pool.h: Likewise. * collect2.cc: Likewise. * pointer-query.cc: Likewise. * cfgloop.cc: Likewise. * toplev.cc: Likewise. * sese.cc: Likewise. * gengtype.cc: Likewise. * gimplify-me.cc: Likewise. * double-int.cc: Likewise. * bb-reorder.cc: Likewise. * dwarf2out.cc: Likewise. * tree-ssa-loop-ivcanon.cc: Likewise. * tree-ssa-reassoc.cc: Likewise. * cgraph.cc: Likewise. * sel-sched.cc: Likewise. * attribs.cc: Likewise. * expr.cc: Likewise. * tree-ssa-scopedtables.h: Likewise. * gimple-range-cache.cc: Likewise. * ipa-pure-const.cc: Likewise. * tree-inline.cc: Likewise. * genhooks.cc: Likewise. * gimple-range-phi.h: Likewise. * shrink-wrap.cc: Likewise. * tree.cc: Likewise. * gimple.cc: Likewise. * backend.h: Likewise. * opts-common.cc: Likewise. * cfg-flags.def: Likewise. * gcse-common.cc: Likewise. * tree-ssa-scopedtables.cc: Likewise. * ccmp.cc: Likewise. * builtins.def: Likewise. * builtin-attrs.def: Likewise. * postreload.cc: Likewise. * sched-deps.cc: Likewise. * ipa-inline-transform.cc: Likewise. * tree-vect-generic.cc: Likewise. * ipa-polymorphic-call.cc: Likewise. * builtins.cc: Likewise. * sel-sched-ir.cc: Likewise. * trans-mem.cc: Likewise. * ipa-visibility.cc: Likewise. * cgraph.h: Likewise. * tree-ssa-phiopt.cc: Likewise. * genopinit.cc: Likewise. * ipa-inline.cc: Likewise. * omp-low.cc: Likewise. * ipa-utils.cc: Likewise. * tree-ssa-math-opts.cc: Likewise. * tree-ssa-ifcombine.cc: Likewise. * gimple-range.cc: Likewise. * ipa-fnsummary.cc: Likewise. * ira-color.cc: Likewise. * value-prof.cc: Likewise. * varasm.cc: Likewise. * ipa-icf.cc: Likewise. * ira-emit.cc: Likewise. * lto-streamer.h: Likewise. * lto-wrapper.cc: Likewise. * regs.h: Likewise. * gengtype-parse.cc: Likewise. * alias.cc: Likewise. * lto-streamer.cc: Likewise. * real.h: Likewise. * wide-int.h: Likewise. * targhooks.cc: Likewise. * gimple-ssa-warn-access.cc: Likewise. * real.cc: Likewise. * ipa-reference.cc: Likewise. * bitmap.h: Likewise. * ginclude/float.h: Likewise. * ginclude/stddef.h: Likewise. * ginclude/stdarg.h: Likewise. * ginclude/stdatomic.h: Likewise. * optabs.h: Likewise. * sel-sched-ir.h: Likewise. * convert.cc: Likewise. * cgraphunit.cc: Likewise. * lra-remat.cc: Likewise. * tree-if-conv.cc: Likewise. * gcov-dump.cc: Likewise. * tree-predcom.cc: Likewise. * dominance.cc: Likewise. * gimple-range-cache.h: Likewise. * ipa-devirt.cc: Likewise. * rtl.h: Likewise. * ubsan.cc: Likewise. * tree-ssa.cc: Likewise. * ssa.h: Likewise. * cse.cc: Likewise. * jump.cc: Likewise. * hwint.h: Likewise. * caller-save.cc: Likewise. * coretypes.h: Likewise. * ipa-fnsummary.h: Likewise. * tree-ssa-strlen.cc: Likewise. * modulo-sched.cc: Likewise. * cgraphclones.cc: Likewise. * lto-cgraph.cc: Likewise. * hw-doloop.h: Likewise. * data-streamer.h: Likewise. * compare-elim.cc: Likewise. * profile-count.h: Likewise. * tree-vect-loop-manip.cc: Likewise. * ree.cc: Likewise. * reload.cc: Likewise. * tree-ssa-loop-split.cc: Likewise. * tree-into-ssa.cc: Likewise. * gcse.cc: Likewise. * cfgloopmanip.cc: Likewise. * df.h: Likewise. * fold-const.cc: Likewise. * wide-int.cc: Likewise. * gengtype-state.cc: Likewise. * sanitizer.def: Likewise. * tree-ssa-sink.cc: Likewise. * target-hooks-macros.h: Likewise. * tree-ssa-pre.cc: Likewise. * gimple-pretty-print.cc: Likewise. * ipa-utils.h: Likewise. * tree-outof-ssa.cc: Likewise. * tree-ssa-coalesce.cc: Likewise. * gimple-match.h: Likewise. * tree-ssa-loop-niter.cc: Likewise. * tree-loop-distribution.cc: Likewise. * tree-emutls.cc: Likewise. * tree-eh.cc: Likewise. * varpool.cc: Likewise. * ssa-iterators.h: Likewise. * asan.cc: Likewise. * reload1.cc: Likewise. * cfgloopanal.cc: Likewise. * tree-vectorizer.cc: Likewise. * simplify-rtx.cc: Likewise. * opts-global.cc: Likewise. * gimple-ssa-store-merging.cc: Likewise. * expmed.cc: Likewise. * tree-ssa-loop-prefetch.cc: Likewise. * tree-ssa-dse.h: Likewise. * tree-vect-stmts.cc: Likewise. * gimple-fold.cc: Likewise. * lra-coalesce.cc: Likewise. * data-streamer-out.cc: Likewise. * diagnostic.cc: Likewise. * tree-ssa-alias.cc: Likewise. * tree-vect-patterns.cc: Likewise. * common/common-target.def: Likewise. * common/config/rx/rx-common.cc: Likewise. * common/config/msp430/msp430-common.cc: Likewise. * common/config/avr/avr-common.cc: Likewise. * common/config/i386/i386-common.cc: Likewise. * common/config/pdp11/pdp11-common.cc: Likewise. * common/config/rs6000/rs6000-common.cc: Likewise. * common/config/mcore/mcore-common.cc: Likewise. * graphite.cc: Likewise. * gimple-low.cc: Likewise. * genmodes.cc: Likewise. * gimple-loop-jam.cc: Likewise. * lto-streamer-out.cc: Likewise. * predict.cc: Likewise. * omp-expand.cc: Likewise. * gimple-array-bounds.cc: Likewise. * predict.def: Likewise. * opts.h: Likewise. * tree-stdarg.cc: Likewise. * gimplify.cc: Likewise. * ira-lives.cc: Likewise. * loop-doloop.cc: Likewise. * lra.cc: Likewise. * gimple-iterator.h: Likewise. * tree-sra.cc: Likewise. gcc/fortran/ * trans-openmp.cc: Remove trailing whitespace. * trans-common.cc: Likewise. * match.h: Likewise. * scanner.cc: Likewise. * gfortranspec.cc: Likewise. * io.cc: Likewise. * iso-c-binding.def: Likewise. * iso-fortran-env.def: Likewise. * types.def: Likewise. * openmp.cc: Likewise. * f95-lang.cc: Likewise. gcc/analyzer/ * state-purge.cc: Remove trailing whitespace. * region-model.h: Likewise. * region-model.cc: Likewise. * program-point.cc: Likewise. * exploded-graph.h: Likewise. * program-state.cc: Likewise. * supergraph.cc: Likewise. gcc/c-family/ * c-ubsan.cc: Remove trailing whitespace. * stub-objc.cc: Likewise. * c-pragma.cc: Likewise. * c-ppoutput.cc: Likewise. * c-indentation.cc: Likewise. * c-ada-spec.cc: Likewise. * c-opts.cc: Likewise. * c-common.cc: Likewise. * c-format.cc: Likewise. * c-omp.cc: Likewise. * c-objc.h: Likewise. * c-cppbuiltin.cc: Likewise. * c-attribs.cc: Likewise. * c-target.def: Likewise. * c-common.h: Likewise. gcc/c/ * c-typeck.cc: Remove trailing whitespace. * gimple-parser.cc: Likewise. * c-parser.cc: Likewise. * c-decl.cc: Likewise. gcc/cp/ * vtable-class-hierarchy.cc: Remove trailing whitespace. * typeck2.cc: Likewise. * decl.cc: Likewise. * init.cc: Likewise. * semantics.cc: Likewise. * module.cc: Likewise. * rtti.cc: Likewise. * cxx-pretty-print.cc: Likewise. * cvt.cc: Likewise. * mangle.cc: Likewise. * name-lookup.h: Likewise. * coroutines.cc: Likewise. * error.cc: Likewise. * lambda.cc: Likewise. * tree.cc: Likewise. * g++spec.cc: Likewise. * decl2.cc: Likewise. * cp-tree.h: Likewise. * parser.cc: Likewise. * pt.cc: Likewise. * call.cc: Likewise. * lex.cc: Likewise. * cp-lang.cc: Likewise. * cp-tree.def: Likewise. * constexpr.cc: Likewise. * typeck.cc: Likewise. * name-lookup.cc: Likewise. * optimize.cc: Likewise. * search.cc: Likewise. * mapper-client.cc: Likewise. * ptree.cc: Likewise. * class.cc: Likewise. gcc/jit/ * docs/examples/tut04-toyvm/toyvm.cc: Remove trailing whitespace. gcc/lto/ * lto-object.cc: Remove trailing whitespace. * lto-symtab.cc: Likewise. * lto-partition.cc: Likewise. * lang-specs.h: Likewise. * lto-lang.cc: Likewise. gcc/objc/ * objc-encoding.cc: Remove trailing whitespace. * objc-map.h: Likewise. * objc-next-runtime-abi-01.cc: Likewise. * objc-act.cc: Likewise. * objc-map.cc: Likewise. gcc/objcp/ * objcp-decl.cc: Remove trailing whitespace. * objcp-lang.cc: Likewise. * objcp-decl.h: Likewise. gcc/rust/ * util/optional.h: Remove trailing whitespace. * util/expected.h: Likewise. * util/rust-unicode-data.h: Likewise. gcc/m2/ * mc-boot/GFpuIO.cc: Remove trailing whitespace. * mc-boot/GFIO.cc: Likewise. * mc-boot/GFormatStrings.cc: Likewise. * mc-boot/GCmdArgs.cc: Likewise. * mc-boot/GDebug.h: Likewise. * mc-boot/GM2Dependent.cc: Likewise. * mc-boot/GRTint.cc: Likewise. * mc-boot/GDebug.cc: Likewise. * mc-boot/GmcError.cc: Likewise. * mc-boot/Gmcp4.cc: Likewise. * mc-boot/GM2RTS.cc: Likewise. * mc-boot/GIO.cc: Likewise. * mc-boot/Gmcp5.cc: Likewise. * mc-boot/GDynamicStrings.cc: Likewise. * mc-boot/Gmcp1.cc: Likewise. * mc-boot/GFormatStrings.h: Likewise. * mc-boot/Gmcp2.cc: Likewise. * mc-boot/Gmcp3.cc: Likewise. * pge-boot/GFIO.cc: Likewise. * pge-boot/GDebug.h: Likewise. * pge-boot/GM2Dependent.cc: Likewise. * pge-boot/GDebug.cc: Likewise. * pge-boot/GM2RTS.cc: Likewise. * pge-boot/GSymbolKey.cc: Likewise. * pge-boot/GIO.cc: Likewise. * pge-boot/GIndexing.cc: Likewise. * pge-boot/GDynamicStrings.cc: Likewise. * pge-boot/GFormatStrings.h: Likewise. gcc/go/ * go-gcc.cc: Remove trailing whitespace. * gospec.cc: Likewise.
400 lines
11 KiB
C
400 lines
11 KiB
C
/* HOST_WIDE_INT definitions for the GNU compiler.
|
|
Copyright (C) 1998-2024 Free Software Foundation, Inc.
|
|
|
|
This file is part of GCC.
|
|
|
|
Provide definitions for macros which depend on HOST_BITS_PER_INT
|
|
and HOST_BITS_PER_LONG. */
|
|
|
|
#ifndef GCC_HWINT_H
|
|
#define GCC_HWINT_H
|
|
|
|
/* This describes the machine the compiler is hosted on. */
|
|
#define HOST_BITS_PER_CHAR CHAR_BIT
|
|
#define HOST_BITS_PER_SHORT (CHAR_BIT * SIZEOF_SHORT)
|
|
#define HOST_BITS_PER_INT (CHAR_BIT * SIZEOF_INT)
|
|
#define HOST_BITS_PER_LONG (CHAR_BIT * SIZEOF_LONG)
|
|
#define HOST_BITS_PER_PTR (CHAR_BIT * SIZEOF_VOID_P)
|
|
|
|
/* The string that should be inserted into a printf style format to
|
|
indicate a "long" operand. */
|
|
#ifndef HOST_LONG_FORMAT
|
|
#define HOST_LONG_FORMAT "l"
|
|
#endif
|
|
|
|
/* The string that should be inserted into a printf style format to
|
|
indicate a "long long" operand. */
|
|
#ifndef HOST_LONG_LONG_FORMAT
|
|
#define HOST_LONG_LONG_FORMAT "ll"
|
|
#endif
|
|
|
|
/* If HAVE_LONG_LONG and SIZEOF_LONG_LONG aren't defined, but
|
|
GCC_VERSION >= 3000, assume this is the second or later stage of a
|
|
bootstrap, we do have long long, and it's 64 bits. (This is
|
|
required by C99; we do have some ports that violate that assumption
|
|
but they're all cross-compile-only.) Just in case, force a
|
|
constraint violation if that assumption is incorrect. */
|
|
#if !defined HAVE_LONG_LONG
|
|
# if GCC_VERSION >= 3000
|
|
# define HAVE_LONG_LONG 1
|
|
# define SIZEOF_LONG_LONG 8
|
|
extern char sizeof_long_long_must_be_8[sizeof (long long) == 8 ? 1 : -1];
|
|
# endif
|
|
#endif
|
|
|
|
#ifdef HAVE_LONG_LONG
|
|
# define HOST_BITS_PER_LONGLONG (CHAR_BIT * SIZEOF_LONG_LONG)
|
|
#endif
|
|
|
|
/* Set HOST_WIDE_INT, this should be always 64 bits.
|
|
The underlying type is matched to that of int64_t and assumed
|
|
to be either long or long long. */
|
|
|
|
#define HOST_BITS_PER_WIDE_INT 64
|
|
#if INT64_T_IS_LONG
|
|
# define HOST_WIDE_INT long
|
|
# define HOST_WIDE_INT_C(X) X ## L
|
|
#else
|
|
# if HOST_BITS_PER_LONGLONG == 64
|
|
# define HOST_WIDE_INT long long
|
|
# define HOST_WIDE_INT_C(X) X ## LL
|
|
# else
|
|
#error "Unable to find a suitable type for HOST_WIDE_INT"
|
|
# endif
|
|
#endif
|
|
|
|
#define HOST_WIDE_INT_UC(X) HOST_WIDE_INT_C (X ## U)
|
|
#define HOST_WIDE_INT_0 HOST_WIDE_INT_C (0)
|
|
#define HOST_WIDE_INT_0U HOST_WIDE_INT_UC (0)
|
|
#define HOST_WIDE_INT_1 HOST_WIDE_INT_C (1)
|
|
#define HOST_WIDE_INT_1U HOST_WIDE_INT_UC (1)
|
|
#define HOST_WIDE_INT_M1 HOST_WIDE_INT_C (-1)
|
|
#define HOST_WIDE_INT_M1U HOST_WIDE_INT_UC (-1)
|
|
|
|
/* This is a magic identifier which allows GCC to figure out the type
|
|
of HOST_WIDE_INT for %wd specifier checks. You must issue this
|
|
typedef before using the __asm_fprintf__ format attribute. */
|
|
typedef HOST_WIDE_INT __gcc_host_wide_int__;
|
|
|
|
/* Provide C99 <inttypes.h> style format definitions for 64bits. */
|
|
#ifndef HAVE_INTTYPES_H
|
|
#if INT64_T_IS_LONG
|
|
# define GCC_PRI64 HOST_LONG_FORMAT
|
|
#else
|
|
# define GCC_PRI64 HOST_LONG_LONG_FORMAT
|
|
#endif
|
|
#undef PRId64
|
|
#define PRId64 GCC_PRI64 "d"
|
|
#undef PRIi64
|
|
#define PRIi64 GCC_PRI64 "i"
|
|
#undef PRIo64
|
|
#define PRIo64 GCC_PRI64 "o"
|
|
#undef PRIu64
|
|
#define PRIu64 GCC_PRI64 "u"
|
|
#undef PRIx64
|
|
#define PRIx64 GCC_PRI64 "x"
|
|
#undef PRIX64
|
|
#define PRIX64 GCC_PRI64 "X"
|
|
#endif
|
|
|
|
/* Various printf format strings for HOST_WIDE_INT. */
|
|
|
|
#if INT64_T_IS_LONG
|
|
# define HOST_WIDE_INT_PRINT HOST_LONG_FORMAT
|
|
# define HOST_WIDE_INT_PRINT_C "L"
|
|
#else
|
|
# define HOST_WIDE_INT_PRINT HOST_LONG_LONG_FORMAT
|
|
# define HOST_WIDE_INT_PRINT_C "LL"
|
|
#endif
|
|
|
|
#define HOST_WIDE_INT_PRINT_DEC "%" PRId64
|
|
#define HOST_WIDE_INT_PRINT_DEC_C "%" PRId64 HOST_WIDE_INT_PRINT_C
|
|
#define HOST_WIDE_INT_PRINT_UNSIGNED "%" PRIu64
|
|
#define HOST_WIDE_INT_PRINT_HEX "%#" PRIx64
|
|
#define HOST_WIDE_INT_PRINT_HEX_PURE "%" PRIx64
|
|
#define HOST_WIDE_INT_PRINT_DOUBLE_HEX "0x%" PRIx64 "%016" PRIx64
|
|
#define HOST_WIDE_INT_PRINT_PADDED_HEX "%016" PRIx64
|
|
|
|
/* Similarly format modifier for printing size_t. As not all hosts support
|
|
z modifier in printf, use GCC_PRISZ and cast argument to fmt_size_t.
|
|
So, instead of doing fprintf ("%zu\n", sizeof (x) * y); use
|
|
fprintf (HOST_SIZE_T_PRINT_UNSIGNED "\n",
|
|
(fmt_size_t) (sizeof (x) * y)); */
|
|
#if SIZE_MAX <= UINT_MAX
|
|
# define GCC_PRISZ ""
|
|
# define fmt_size_t unsigned int
|
|
#elif SIZE_MAX <= ULONG_MAX
|
|
# define GCC_PRISZ HOST_LONG_FORMAT
|
|
# define fmt_size_t unsigned long int
|
|
#else
|
|
# define GCC_PRISZ HOST_LONG_LONG_FORMAT
|
|
# define fmt_size_t unsigned long long int
|
|
#endif
|
|
|
|
#define HOST_SIZE_T_PRINT_DEC "%" GCC_PRISZ "d"
|
|
#define HOST_SIZE_T_PRINT_UNSIGNED "%" GCC_PRISZ "u"
|
|
#define HOST_SIZE_T_PRINT_HEX "%#" GCC_PRISZ "x"
|
|
#define HOST_SIZE_T_PRINT_HEX_PURE "%" GCC_PRISZ "x"
|
|
|
|
/* Define HOST_WIDEST_FAST_INT to the widest integer type supported
|
|
efficiently in hardware. (That is, the widest integer type that fits
|
|
in a hardware register.) Normally this is "long" but on some hosts it
|
|
should be "long long" or "__int64". This is no convenient way to
|
|
autodetect this, so such systems must set a flag in config.host; see there
|
|
for details. */
|
|
|
|
#ifdef USE_LONG_LONG_FOR_WIDEST_FAST_INT
|
|
# ifdef HAVE_LONG_LONG
|
|
# define HOST_WIDEST_FAST_INT long long
|
|
# define HOST_BITS_PER_WIDEST_FAST_INT HOST_BITS_PER_LONGLONG
|
|
# else
|
|
# error "Your host said it wanted to use long long but that does not exist"
|
|
# endif
|
|
#else
|
|
# define HOST_WIDEST_FAST_INT long
|
|
# define HOST_BITS_PER_WIDEST_FAST_INT HOST_BITS_PER_LONG
|
|
#endif
|
|
|
|
/* Inline functions operating on HOST_WIDE_INT. */
|
|
|
|
/* Return X with all but the lowest bit masked off. */
|
|
|
|
inline unsigned HOST_WIDE_INT
|
|
least_bit_hwi (unsigned HOST_WIDE_INT x)
|
|
{
|
|
return (x & -x);
|
|
}
|
|
|
|
/* True if X is zero or a power of two. */
|
|
|
|
inline bool
|
|
pow2_or_zerop (unsigned HOST_WIDE_INT x)
|
|
{
|
|
return least_bit_hwi (x) == x;
|
|
}
|
|
|
|
/* True if X is a power of two. */
|
|
|
|
inline bool
|
|
pow2p_hwi (unsigned HOST_WIDE_INT x)
|
|
{
|
|
return x && pow2_or_zerop (x);
|
|
}
|
|
|
|
#if GCC_VERSION < 3004
|
|
|
|
extern int clz_hwi (unsigned HOST_WIDE_INT x);
|
|
extern int ctz_hwi (unsigned HOST_WIDE_INT x);
|
|
extern int ffs_hwi (unsigned HOST_WIDE_INT x);
|
|
|
|
/* Return the number of set bits in X. */
|
|
extern int popcount_hwi (unsigned HOST_WIDE_INT x);
|
|
|
|
/* Return log2, or -1 if not exact. */
|
|
extern int exact_log2 (unsigned HOST_WIDE_INT);
|
|
|
|
/* Return floor of log2, with -1 for zero. */
|
|
extern int floor_log2 (unsigned HOST_WIDE_INT);
|
|
|
|
/* Return the smallest n such that 2**n >= X. */
|
|
extern int ceil_log2 (unsigned HOST_WIDE_INT);
|
|
|
|
#else /* GCC_VERSION >= 3004 */
|
|
|
|
/* For convenience, define 0 -> word_size. */
|
|
inline int
|
|
clz_hwi (unsigned HOST_WIDE_INT x)
|
|
{
|
|
if (x == 0)
|
|
return HOST_BITS_PER_WIDE_INT;
|
|
# if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG
|
|
return __builtin_clzl (x);
|
|
# elif HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONGLONG
|
|
return __builtin_clzll (x);
|
|
# else
|
|
return __builtin_clz (x);
|
|
# endif
|
|
}
|
|
|
|
inline int
|
|
ctz_hwi (unsigned HOST_WIDE_INT x)
|
|
{
|
|
if (x == 0)
|
|
return HOST_BITS_PER_WIDE_INT;
|
|
# if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG
|
|
return __builtin_ctzl (x);
|
|
# elif HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONGLONG
|
|
return __builtin_ctzll (x);
|
|
# else
|
|
return __builtin_ctz (x);
|
|
# endif
|
|
}
|
|
|
|
inline int
|
|
ffs_hwi (unsigned HOST_WIDE_INT x)
|
|
{
|
|
# if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG
|
|
return __builtin_ffsl (x);
|
|
# elif HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONGLONG
|
|
return __builtin_ffsll (x);
|
|
# else
|
|
return __builtin_ffs (x);
|
|
# endif
|
|
}
|
|
|
|
inline int
|
|
popcount_hwi (unsigned HOST_WIDE_INT x)
|
|
{
|
|
# if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG
|
|
return __builtin_popcountl (x);
|
|
# elif HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONGLONG
|
|
return __builtin_popcountll (x);
|
|
# else
|
|
return __builtin_popcount (x);
|
|
# endif
|
|
}
|
|
|
|
inline int
|
|
floor_log2 (unsigned HOST_WIDE_INT x)
|
|
{
|
|
return HOST_BITS_PER_WIDE_INT - 1 - clz_hwi (x);
|
|
}
|
|
|
|
inline int
|
|
ceil_log2 (unsigned HOST_WIDE_INT x)
|
|
{
|
|
return x == 0 ? 0 : floor_log2 (x - 1) + 1;
|
|
}
|
|
|
|
inline int
|
|
exact_log2 (unsigned HOST_WIDE_INT x)
|
|
{
|
|
return pow2p_hwi (x) ? ctz_hwi (x) : -1;
|
|
}
|
|
|
|
#endif /* GCC_VERSION >= 3004 */
|
|
|
|
#define HOST_WIDE_INT_MIN (HOST_WIDE_INT) \
|
|
(HOST_WIDE_INT_1U << (HOST_BITS_PER_WIDE_INT - 1))
|
|
#define HOST_WIDE_INT_MAX (~(HOST_WIDE_INT_MIN))
|
|
|
|
extern HOST_WIDE_INT abs_hwi (HOST_WIDE_INT);
|
|
extern unsigned HOST_WIDE_INT absu_hwi (HOST_WIDE_INT);
|
|
extern HOST_WIDE_INT gcd (HOST_WIDE_INT, HOST_WIDE_INT);
|
|
extern HOST_WIDE_INT pos_mul_hwi (HOST_WIDE_INT, HOST_WIDE_INT);
|
|
extern HOST_WIDE_INT mul_hwi (HOST_WIDE_INT, HOST_WIDE_INT);
|
|
extern HOST_WIDE_INT least_common_multiple (HOST_WIDE_INT, HOST_WIDE_INT);
|
|
|
|
/* Like ctz_hwi, except 0 when x == 0. */
|
|
|
|
inline int
|
|
ctz_or_zero (unsigned HOST_WIDE_INT x)
|
|
{
|
|
return ffs_hwi (x) - 1;
|
|
}
|
|
|
|
/* Sign extend SRC starting from PREC. */
|
|
|
|
inline HOST_WIDE_INT
|
|
sext_hwi (HOST_WIDE_INT src, unsigned int prec)
|
|
{
|
|
if (prec == HOST_BITS_PER_WIDE_INT)
|
|
return src;
|
|
else
|
|
#if defined (__GNUC__)
|
|
{
|
|
/* Take the faster path if the implementation-defined bits it's relying
|
|
on are implemented the way we expect them to be. Namely, conversion
|
|
from unsigned to signed preserves bit pattern, and right shift of
|
|
a signed value propagates the sign bit.
|
|
We have to convert from signed to unsigned and back, because when left
|
|
shifting signed values, any overflow is undefined behavior. */
|
|
gcc_checking_assert (prec < HOST_BITS_PER_WIDE_INT);
|
|
int shift = HOST_BITS_PER_WIDE_INT - prec;
|
|
return ((HOST_WIDE_INT) ((unsigned HOST_WIDE_INT) src << shift)) >> shift;
|
|
}
|
|
#else
|
|
{
|
|
/* Fall back to the slower, well defined path otherwise. */
|
|
gcc_checking_assert (prec < HOST_BITS_PER_WIDE_INT);
|
|
HOST_WIDE_INT sign_mask = HOST_WIDE_INT_1 << (prec - 1);
|
|
HOST_WIDE_INT value_mask = (HOST_WIDE_INT_1U << prec) - HOST_WIDE_INT_1U;
|
|
return (((src & value_mask) ^ sign_mask) - sign_mask);
|
|
}
|
|
#endif
|
|
}
|
|
|
|
/* Zero extend SRC starting from PREC. */
|
|
inline unsigned HOST_WIDE_INT
|
|
zext_hwi (unsigned HOST_WIDE_INT src, unsigned int prec)
|
|
{
|
|
if (prec == HOST_BITS_PER_WIDE_INT)
|
|
return src;
|
|
else
|
|
{
|
|
gcc_checking_assert (prec < HOST_BITS_PER_WIDE_INT);
|
|
return src & ((HOST_WIDE_INT_1U << prec) - 1);
|
|
}
|
|
}
|
|
|
|
/* Compute the absolute value of X. */
|
|
|
|
inline HOST_WIDE_INT
|
|
abs_hwi (HOST_WIDE_INT x)
|
|
{
|
|
gcc_checking_assert (x != HOST_WIDE_INT_MIN);
|
|
return x >= 0 ? x : -x;
|
|
}
|
|
|
|
/* Compute the absolute value of X as an unsigned type. */
|
|
|
|
inline unsigned HOST_WIDE_INT
|
|
absu_hwi (HOST_WIDE_INT x)
|
|
{
|
|
return x >= 0 ? (unsigned HOST_WIDE_INT)x : -(unsigned HOST_WIDE_INT)x;
|
|
}
|
|
|
|
/* Compute the sum of signed A and B and indicate in *OVERFLOW whether
|
|
that operation overflowed. */
|
|
|
|
inline HOST_WIDE_INT
|
|
add_hwi (HOST_WIDE_INT a, HOST_WIDE_INT b, bool *overflow)
|
|
{
|
|
#if GCC_VERSION < 11000
|
|
unsigned HOST_WIDE_INT result = a + (unsigned HOST_WIDE_INT)b;
|
|
if ((((result ^ a) & (result ^ b))
|
|
>> (HOST_BITS_PER_WIDE_INT - 1)) & 1)
|
|
*overflow = true;
|
|
else
|
|
*overflow = false;
|
|
return result;
|
|
#else
|
|
HOST_WIDE_INT result;
|
|
*overflow = __builtin_add_overflow (a, b, &result);
|
|
return result;
|
|
#endif
|
|
}
|
|
|
|
/* Compute the product of signed A and B and indicate in *OVERFLOW whether
|
|
that operation overflowed. */
|
|
|
|
inline HOST_WIDE_INT
|
|
mul_hwi (HOST_WIDE_INT a, HOST_WIDE_INT b, bool *overflow)
|
|
{
|
|
#if GCC_VERSION < 11000
|
|
unsigned HOST_WIDE_INT result = a * (unsigned HOST_WIDE_INT)b;
|
|
if ((a == -1 && b == HOST_WIDE_INT_MIN)
|
|
|| (a != 0 && (HOST_WIDE_INT)result / a != b))
|
|
*overflow = true;
|
|
else
|
|
*overflow = false;
|
|
return result;
|
|
#else
|
|
HOST_WIDE_INT result;
|
|
*overflow = __builtin_mul_overflow (a, b, &result);
|
|
return result;
|
|
#endif
|
|
}
|
|
|
|
#endif /* ! GCC_HWINT_H */
|