aboutsummaryrefslogtreecommitdiff
path: root/gcc/m2/gm2-gcc
AgeCommit message (Collapse)AuthorFilesLines
2025-03-25PR modula2/119449 MAX of SYSTEM.REAL64 cause an ICEGaius Mulley2-11/+19
This bugfix implements MAX(REAL64) and MIN(REAL64) etc for REAL64, REAL96 and REAL128. gcc/m2/ChangeLog: PR modula2/119449 * gm2-compiler/M2GCCDeclare.def (TryDeclareType): Remove tokenno parameter. * gm2-compiler/M2GCCDeclare.mod (TryDeclareType): Ditto. * gm2-compiler/M2GenGCC.mod (FoldTBitsize): Remove op2 and rename op1 as res and op3 as type. (FoldStandardFunction): Call FoldTBitsize omitting op2. * gm2-compiler/M2Quads.mod (GetTypeMin): Rewrite. (GetTypeMinLower): New procedure function. (GetTypeMax): Rewrite. (GetTypeMaxLower): New procedure function. * gm2-compiler/M2Range.mod (CheckCancelled): Comment out. * gm2-compiler/M2System.mod (CreateMinMaxFor): Add realtype parameter. (MapType): Rewrite to use realtype. (CreateType): Ditto. (AttemptToCreateType): Ditto. (MakeFixedSizedTypes): Add realtype boolean. (InitPIMTypes): Ditto. (InitISOTypes): Ditto. (MakeExtraSystemTypes): Ditto. * gm2-gcc/m2pp.cc (m2pp_nop_expr): Remove code. * gm2-gcc/m2type.cc (IsGccRealType): New function. (m2type_GetMinFrom): Rewrite. (m2type_GetMaxFrom): Ditto. (do_min_real): Declare static. (do_max_real): Declare static. gcc/testsuite/ChangeLog: PR modula2/119449 * gm2/pim/pass/minmaxreal.mod: New test. * gm2/pim/pass/minmaxreal2.mod: New test. * gm2/pim/pass/minmaxreal3.mod: New test. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2025-03-20PR modula2/118600 Assigning to a record causes alignment exceptionGaius Mulley9-9/+228
This patch recursively tests every assignment (of a constructor to a designator) to ensure the types are GCC equivalent. If they are equivalent then it uses gimple assignment and if not then it copies a structure by field and uses __builtin_strncpy to copy a string cst into an array. Unions are copied by __builtin_memcpy. gcc/m2/ChangeLog: PR modula2/118600 * gm2-compiler/M2GenGCC.mod (PerformCodeBecomes): New procedure. (CodeBecomes): Refactor and call PerformCodeBecomes. * gm2-gcc/m2builtins.cc (gm2_strncpy_node): New global variable. (DoBuiltinStrNCopy): New function. (m2builtins_BuiltinStrNCopy): New function. (m2builtins_init): Initialize gm2_strncpy_node. * gm2-gcc/m2builtins.def (BuiltinStrNCopy): New procedure function. * gm2-gcc/m2builtins.h (m2builtins_BuiltinStrNCopy): New function. * gm2-gcc/m2statement.cc (copy_record_fields): New function. (copy_array): Ditto. (copy_strncpy): Ditto. (copy_memcpy): Ditto. (CopyByField_Lower): Ditto. (m2statement_CopyByField): Ditto. * gm2-gcc/m2statement.def (CopyByField): New procedure function. * gm2-gcc/m2statement.h (m2statement_CopyByField): New function. * gm2-gcc/m2type.cc (check_record_fields): Ditto. (check_array_types): Ditto. (m2type_IsGccStrictTypeEquivalent): Ditto. * gm2-gcc/m2type.def (IsGccStrictTypeEquivalent): New procedure function. * gm2-gcc/m2type.h (m2type_IsAddress): Replace return type int with bool. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2025-03-16PR modula2/115111 Incorrect line debugging locations at the end of the WHILE ↵Gaius Mulley2-17/+19
loop This fix corrects the END token position used during the GotoOp at the bottom of the WHILE loop. The fix is to pass the relative token position down to M2Quads. This method should be replicated for the other loops END or UNTIL keywords and possibly the END statements for conditional statements. gcc/m2/ChangeLog: PR modula2/115111 * gm2-compiler/M2GenGCC.mod (CodeStatementNote): Add debugging. * gm2-compiler/M2Quads.def (BuildEndWhile): New parameter reltokpos. * gm2-compiler/M2Quads.mod (BuildEndWhile): Reimplement using new parameter. * gm2-compiler/P3Build.bnf (WhileStatement): Call BuildEndWhile with -1 relative position. * gm2-gcc/m2block.cc (do_add_stmt): Tidy comment. (GetGlobals): Ditto. (flush_pending_note): Remove #if 0 code. * gm2-gcc/m2pp.cc (m2pp_nop_expr): New function. (m2pp_statement): New case clause call m2pp_nop_expr. gcc/testsuite/ChangeLog: PR modula2/115111 * gm2/pim/pass/whilestep.mod: New test. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2025-03-10PR modula2/119192 ICE if TBITSIZE is used in an expressionGaius Mulley3-1/+26
This patch fixes an ICE which will occur is TBITSIZE is used within an expression. gcc/m2/ChangeLog: PR modula2/119192 * gm2-compiler/M2GCCDeclare.def (TryDeclareType): New procedure. * gm2-compiler/M2GCCDeclare.mod (IsAnyType): New procedure. (TryDeclareType): Ditto. * gm2-compiler/M2GenGCC.mod (FoldTBitsize): New procedure. (FoldStandardFunction): Call FoldTBitsize. * gm2-gcc/m2expr.cc (BuildTBitSize): Improve comment. (m2expr_BuildSystemTBitSize): New function. * gm2-gcc/m2expr.def (BuildSystemTBitSize): New procedure function. * gm2-gcc/m2expr.h (m2expr_BuildSystemTBitSize): New function prototype. gcc/testsuite/ChangeLog: PR modula2/119192 * gm2/sets/run/pass/simplepacked.mod: Uncomment asserts. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2025-03-05PR modula2/118998 Rotate of a packetset causes different types to binary ↵Gaius Mulley2-6/+39
operator error This patch allow a packedset to be rotated by the system module intrinsic procedure function. It ensures that both operands to the tree rotate are of the same type. In turn the result will be the same type and the assignment into the designator (of the same set type) will succeed. gcc/m2/ChangeLog: PR modula2/118998 * gm2-gcc/m2expr.cc (m2expr_BuildLRotate): Convert nBits to the return type. (m2expr_BuildRRotate): Ditto. (m2expr_BuildLogicalRotate): Convert op3 to an integer type. Replace op3 aith rotateCount. Negate rotateCount if it is negative and call rotate right. * gm2-gcc/m2pp.cc (m2pp_bit_and_expr): New function. (m2pp_binary_function): Ditto. (m2pp_simple_expression): BIT_AND_EXPR new case clause. LROTATE_EXPR ditto. RROTATE_EXPR ditto. gcc/testsuite/ChangeLog: PR modula2/118998 * gm2/iso/pass/testrotate.mod: New test. * gm2/pim/fail/tinyconst.mod: New test. * gm2/sets/run/pass/simplepacked.mod: New test. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2025-02-01PR modula2/118703 Abort compiling m2pim_NumberIO_BinToStrGaius Mulley1-0/+36
This patch builds access to the gcc builtins clz, clzl, clzll, ctz, ctzl and ctzll within m2builtins.cc. The patch provides modula2 api access to clz, clzll, ctz and ctzll though the Builtins definition module. This PR was raised because of PR118689. gcc/m2/ChangeLog: PR modula2/118703 * gm2-gcc/m2builtins.cc (define_builtin_gcc): New function. (m2builtins_init): Call define_builtin_gcc. * gm2-libs/Builtins.def (clz): New procedure function. (clzll): Ditto. (ctz): Ditto. (ctzll): Ditto. * gm2-libs/Builtins.mod (clz): New procedure function. (clzll): Ditto. (ctz): Ditto. (ctzll): Ditto. * gm2-libs/cbuiltin.def (clz): New procedure function. (clzll): Ditto. (ctz): Ditto. (ctzll): Ditto. gcc/testsuite/ChangeLog: PR modula2/118703 * gm2/builtins/run/pass/testbitfns.mod: New test. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2025-01-29PR modula2/116073 invalid rtl sharing compiling FileSystem.mod caused by ext-dceGaius Mulley1-2/+6
The bug fixes to PR modula2/118010 and PR modula2/118183 uncovered a bug in the procedure interface to lseek which uses SYSTEM.COFF_T rather than SYSTEM.CSSIZE_T. This patch sets the default size for COFF_T to the same as CSSIZE_T. gcc/ChangeLog: PR modula2/118010 PR modula2/118183 PR modula2/116073 * doc/gm2.texi (-fm2-file-offset-bits=): Change the default size description to CSSIZE_T. Add COFF_T to the list of data types exported by SYSTEM.def. gcc/m2/ChangeLog: PR modula2/118010 PR modula2/118183 PR modula2/116073 * gm2-compiler/M2Options.mod (OffTBits): Assign to 0. * gm2-gcc/m2type.cc (build_m2_specific_size_type): Ensure that layout_type is called before returning c. (build_m2_offt_type_node): If GetFileOffsetBits returns 0 then use the type size of ssize_t. gcc/testsuite/ChangeLog: PR modula2/118010 PR modula2/118183 PR modula2/116073 * gm2/pim/run/pass/printtypesize.mod: New test. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2025-01-07[PR modula2/118010, modula2/118183] Unable to rebuild the bootstrap tools ↵Gaius Mulley6-8/+35
and Wtypemismatch This patch combines fixes for both PR-118010 (Wtypemismatch) and PR-118183 (unable to rebuild the bootstrap tools). PR-118010 required a new data type (COFF_T) to be exported from SYSTEM and used in all return types for libc.lseek. The patch also includes COFF_T implemented in mc and this data type has been propagated though the translated versions of pge and mc. Finally the patch adjusts the modula-2 declaration of location_t to reflect the new gcc 64 bit type. A new command line option -fm2-file-offset-bits= has been implemented to override the default 64 bit declaration of COFF_T. gcc/ChangeLog: PR modula2/118010 * doc/gm2.texi (Compiler options): New option -fm2-file-offset-bits=. gcc/m2/ChangeLog: PR modula2/118010 PR modula2/118183 * gm2-compiler/M2GCCDeclare.mod (Import): COffT, GetCOffTType. (DeclareDefaultSimpleTypes): Declare COFF_T. * gm2-compiler/M2GenGCC.mod (GetParamSize): Correct first parameter to BuildSize to use location rather than a token position. * gm2-compiler/M2Options.def (SetFileOffsetBits): New procedure. (GetFileOffsetBits): New procedure function. * gm2-compiler/M2Options.mod (SetFileOffsetBits): New procedure. (GetFileOffsetBits): New procedure function. (OffTBits): New variable. * gm2-compiler/M2System.def (COffT): New variable. * gm2-compiler/M2System.mod (MakeExtraSystemTypes): Declare COffT. * gm2-compiler/P1SymBuild.mod (EndBuildProcedure): Call PutProcedureDefined. * gm2-compiler/P2SymBuild.mod (Debug): Reimplement. * gm2-compiler/SymbolTable.mod (InitProcedureDeclaration): Initialize ProcedureTok. * gm2-gcc/gcctypes.def (location_t): Declare as CARDINAL64. * gm2-gcc/m2linemap.cc (m2linemap_GetLocationBinary): Add call to linemap_add indication a LC_LEAVE. * gm2-gcc/m2options.h (M2Options_SetFileOffsetBits): New procedure. (M2Options_GetFileOffsetBits): New procedure function. * gm2-gcc/m2type.cc (m2_offt_type_node): New variable. (m2type_GetCSizeTType): Reword comment. (m2type_GetCSSizeTType): Reword comment. (m2type_GetCOffTType): New function. (build_m2_offt_type_node): New function. (m2type_InitSystemTypes): Initialize m2_offt_type_node. * gm2-gcc/m2type.def (GetCSizeTType): Reword comment. (GetCOffTType): New procedure function. * gm2-gcc/m2type.h (m2type_GetCOffTType): New prototype. * gm2-lang.cc (gm2_langhook_handle_option): New clause OPT_fm2_file_offset_bits_. * gm2-libs-coroutines/SYSTEM.def: Add COFF_T to export list. * gm2-libs-iso/SYSTEM.def: Ditto. * gm2-libs-min/SYSTEM.def: Ditto. * gm2-libs/SYSTEM.def: Add COFF_T and CARDINAL64 to export list. * gm2-libs/libc.def (lseek): Change return type to COFF_T. * lang.opt (-fm2-file-offset-bits=): New option. * mc-boot-ch/Glibc.c (libc_lseek): Change result to use off_t. * mc-boot/GASCII.cc: Rebuilt. * mc-boot/GASCII.h: Ditto. * mc-boot/GArgs.cc: Ditto. * mc-boot/GArgs.h: Ditto. * mc-boot/GAssertion.cc: Ditto. * mc-boot/GAssertion.h: Ditto. * mc-boot/GBreak.cc: Ditto. * mc-boot/GBreak.h: Ditto. * mc-boot/GCOROUTINES.h: Ditto. * mc-boot/GCmdArgs.cc: Ditto. * mc-boot/GCmdArgs.h: Ditto. * mc-boot/GDebug.cc: Ditto. * mc-boot/GDebug.h: Ditto. * mc-boot/GDynamicStrings.cc: Ditto. * mc-boot/GDynamicStrings.h: Ditto. * mc-boot/GEnvironment.cc: Ditto. * mc-boot/GEnvironment.h: Ditto. * mc-boot/GFIO.cc: Ditto. * mc-boot/GFIO.h: Ditto. * mc-boot/GFormatStrings.cc: Ditto. * mc-boot/GFormatStrings.h: Ditto. * mc-boot/GFpuIO.cc: Ditto. * mc-boot/GFpuIO.h: Ditto. * mc-boot/GIO.cc: Ditto. * mc-boot/GIO.h: Ditto. * mc-boot/GIndexing.cc: Ditto. * mc-boot/GIndexing.h: Ditto. * mc-boot/GM2Dependent.cc: Ditto. * mc-boot/GM2Dependent.h: Ditto. * mc-boot/GM2EXCEPTION.cc: Ditto. * mc-boot/GM2EXCEPTION.h: Ditto. * mc-boot/GM2RTS.cc: Ditto. (M2RTS_Halt): Call libc_exit. (M2RTS_HaltC): Ditto. * mc-boot/GM2RTS.h: Rebuilt. * mc-boot/GMemUtils.cc: Ditto. * mc-boot/GMemUtils.h: Ditto. * mc-boot/GNumberIO.cc: Ditto. * mc-boot/GNumberIO.h: Ditto. * mc-boot/GPushBackInput.cc: Ditto. * mc-boot/GPushBackInput.h: Ditto. * mc-boot/GRTExceptions.cc: Ditto. * mc-boot/GRTExceptions.h: Ditto. * mc-boot/GRTco.h: Ditto. * mc-boot/GRTentity.h: Ditto. * mc-boot/GRTint.cc: Ditto. * mc-boot/GRTint.h: Ditto. * mc-boot/GSArgs.cc: Ditto. * mc-boot/GSArgs.h: Ditto. * mc-boot/GSFIO.cc: Ditto. * mc-boot/GSFIO.h: Ditto. * mc-boot/GSYSTEM.h: Ditto. * mc-boot/GSelective.h: Ditto. * mc-boot/GStdIO.cc: Ditto. * mc-boot/GStdIO.h: Ditto. * mc-boot/GStorage.cc: Ditto. * mc-boot/GStorage.h: Ditto. * mc-boot/GStrCase.cc: Ditto. * mc-boot/GStrCase.h: Ditto. * mc-boot/GStrIO.cc: Ditto. * mc-boot/GStrIO.h: Ditto. * mc-boot/GStrLib.cc: Ditto. * mc-boot/GStrLib.h: Ditto. * mc-boot/GStringConvert.cc: Ditto. * mc-boot/GStringConvert.h: Ditto. * mc-boot/GSysExceptions.h: Ditto. * mc-boot/GSysStorage.cc: Ditto. * mc-boot/GSysStorage.h: Ditto. * mc-boot/GTimeString.cc: Ditto. * mc-boot/GTimeString.h: Ditto. * mc-boot/GUnixArgs.h: Ditto. * mc-boot/Galists.cc: Ditto. * mc-boot/Galists.h: Ditto. * mc-boot/Gdecl.cc: Ditto. * mc-boot/Gdecl.h: Rebuilt. * mc-boot/Gdtoa.h: Ditto. * mc-boot/Gerrno.h: Ditto. * mc-boot/Gkeyc.cc: Ditto. * mc-boot/Gkeyc.h: Rebuilt. * mc-boot/Gldtoa.h: Ditto. * mc-boot/Glibc.h: Ditto. * mc-boot/Glibm.h: Ditto. * mc-boot/Glists.cc: Ditto. * mc-boot/Glists.h: Ditto. * mc-boot/GmcComment.cc: Ditto. * mc-boot/GmcComment.h: Ditto. * mc-boot/GmcComp.cc: Ditto. * mc-boot/GmcComp.h: Ditto. * mc-boot/GmcDebug.cc: Ditto. * mc-boot/GmcDebug.h: Ditto. * mc-boot/GmcError.cc: Ditto. * mc-boot/GmcError.h: Ditto. * mc-boot/GmcFileName.cc: Ditto. * mc-boot/GmcFileName.h: Ditto. * mc-boot/GmcLexBuf.cc: Ditto. * mc-boot/GmcLexBuf.h: Ditto. * mc-boot/GmcMetaError.cc: Ditto. * mc-boot/GmcMetaError.h: Ditto. * mc-boot/GmcOptions.cc: Ditto. * mc-boot/GmcOptions.h: Ditto. * mc-boot/GmcPreprocess.cc: Ditto. * mc-boot/GmcPreprocess.h: Ditto. * mc-boot/GmcPretty.cc: Ditto. * mc-boot/GmcPretty.h: Ditto. * mc-boot/GmcPrintf.cc: Ditto. * mc-boot/GmcPrintf.h: Ditto. * mc-boot/GmcQuiet.cc: Ditto. * mc-boot/GmcQuiet.h: Ditto. * mc-boot/GmcReserved.cc: Ditto. * mc-boot/GmcReserved.h: Ditto. * mc-boot/GmcSearch.cc: Ditto. * mc-boot/GmcSearch.h: Ditto. * mc-boot/GmcStack.cc: Ditto. * mc-boot/GmcStack.h: Ditto. * mc-boot/GmcStream.cc: Ditto. * mc-boot/GmcStream.h: Ditto. * mc-boot/Gmcflex.h: Ditto. * mc-boot/Gmcp1.cc: Ditto. * mc-boot/Gmcp1.h: Ditto. * mc-boot/Gmcp2.cc: Ditto. * mc-boot/Gmcp2.h: Ditto. * mc-boot/Gmcp3.cc: Ditto. * mc-boot/Gmcp3.h: Ditto. * mc-boot/Gmcp4.cc: Ditto. * mc-boot/Gmcp4.h: Ditto. * mc-boot/Gmcp5.cc: Ditto. * mc-boot/Gmcp5.h: Ditto. * mc-boot/GnameKey.cc: Ditto. * mc-boot/GnameKey.h: Ditto. * mc-boot/GsymbolKey.cc: Ditto. * mc-boot/GsymbolKey.h: Ditto. * mc-boot/Gtermios.h: Ditto. * mc-boot/Gtop.cc: Ditto. * mc-boot/Gvarargs.cc: Ditto. * mc-boot/Gvarargs.h: Ditto. * mc-boot/Gwlists.cc: Ditto. * mc-boot/Gwlists.h: Ditto. * mc-boot/Gwrapc.h: Ditto. * mc/decl.mod (cofft): New enum. (cardinal64): Ditto. (cofftN): New variable. (cardinal64N): Ditto. (isProcedure): Remove. (getSymName): Add clause for cofft and cardinal64. (makeBase): Ditto. (isOrdinal): Ditto. (getType): Ditto. (doGetExprType): Ditto. (getScope): Ditto. (doExprC): Ditto. (isSystem): Ditto. (doSystemC): Ditto. (doDependants): Ditto. (visitDependants): Ditto. (genKind): Ditto. (doSystemM2): Ditto. (doDupExpr): Ditto. (makeSystem): Initialize cofftN and cardinal64N. * mc/keyc.mod (useUIntMin): Remove. (useUIntMax): Ditto. * pge-boot/GIndexing.h: Rebuilt. * pge-boot/GSEnvironment.h: Ditto. * pge-boot/GScan.h: Ditto. * pge-boot/Glibc.h: Ditto. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2025-01-02Update copyright years.Jakub Jelinek63-63/+63
2024-11-22build: Remove INCLUDE_MEMORY [PR117737]Andrew Pinski2-2/+0
Since diagnostic.h is included in over half of the sources, requiring to `#define INCLUDE_MEMORY` does not make sense. Instead lets unconditionally include memory in system.h. The majority of this patch is just removing `#define INCLUDE_MEMORY` from the sources which currently have it. This should also fix the mingw build issue but I have not tried it. Bootstrapped and tested on x86_64-linux-gnu. PR bootstrap/117737 gcc/ada/ChangeLog: * gcc-interface/misc.cc (INCLUDE_MEMORY): Remove. * gcc-interface/trans.cc (INCLUDE_MEMORY): Remove. * gcc-interface/utils.cc (INCLUDE_MEMORY): Remove. gcc/analyzer/ChangeLog: * access-diagram.cc (INCLUDE_MEMORY): Remove. * analysis-plan.cc (INCLUDE_MEMORY): Remove. * analyzer-language.cc (INCLUDE_MEMORY): Remove. * analyzer-logging.cc (INCLUDE_MEMORY): Remove. * analyzer-pass.cc (INCLUDE_MEMORY): Remove. * analyzer-selftests.cc (INCLUDE_MEMORY): Remove. * analyzer.cc (INCLUDE_MEMORY): Remove. * bar-chart.cc (INCLUDE_MEMORY): Remove. * bounds-checking.cc (INCLUDE_MEMORY): Remove. * call-details.cc (INCLUDE_MEMORY): Remove. * call-info.cc (INCLUDE_MEMORY): Remove. * call-string.cc (INCLUDE_MEMORY): Remove. * call-summary.cc (INCLUDE_MEMORY): Remove. * checker-event.cc (INCLUDE_MEMORY): Remove. * checker-path.cc (INCLUDE_MEMORY): Remove. * complexity.cc (INCLUDE_MEMORY): Remove. * constraint-manager.cc (INCLUDE_MEMORY): Remove. * diagnostic-manager.cc (INCLUDE_MEMORY): Remove. * engine.cc (INCLUDE_MEMORY): Remove. * feasible-graph.cc (INCLUDE_MEMORY): Remove. * infinite-loop.cc (INCLUDE_MEMORY): Remove. * infinite-recursion.cc (INCLUDE_MEMORY): Remove. * kf-analyzer.cc (INCLUDE_MEMORY): Remove. * kf-lang-cp.cc (INCLUDE_MEMORY): Remove. * kf.cc (INCLUDE_MEMORY): Remove. * known-function-manager.cc (INCLUDE_MEMORY): Remove. * pending-diagnostic.cc (INCLUDE_MEMORY): Remove. * program-point.cc (INCLUDE_MEMORY): Remove. * program-state.cc (INCLUDE_MEMORY): Remove. * ranges.cc (INCLUDE_MEMORY): Remove. * record-layout.cc (INCLUDE_MEMORY): Remove. * region-model-asm.cc (INCLUDE_MEMORY): Remove. * region-model-manager.cc (INCLUDE_MEMORY): Remove. * region-model-reachability.cc (INCLUDE_MEMORY): Remove. * region-model.cc (INCLUDE_MEMORY): Remove. * region.cc (INCLUDE_MEMORY): Remove. * sm-fd.cc (INCLUDE_MEMORY): Remove. * sm-file.cc (INCLUDE_MEMORY): Remove. * sm-malloc.cc (INCLUDE_MEMORY): Remove. * sm-pattern-test.cc (INCLUDE_MEMORY): Remove. * sm-sensitive.cc (INCLUDE_MEMORY): Remove. * sm-signal.cc (INCLUDE_MEMORY): Remove. * sm-taint.cc (INCLUDE_MEMORY): Remove. * sm.cc (INCLUDE_MEMORY): Remove. * state-purge.cc (INCLUDE_MEMORY): Remove. * store.cc (INCLUDE_MEMORY): Remove. * supergraph.cc (INCLUDE_MEMORY): Remove. * svalue.cc (INCLUDE_MEMORY): Remove. * symbol.cc (INCLUDE_MEMORY): Remove. * trimmed-graph.cc (INCLUDE_MEMORY): Remove. * varargs.cc (INCLUDE_MEMORY): Remove. gcc/ChangeLog: * asan.cc (INCLUDE_MEMORY): Remove. * attribs.cc (INCLUDE_MEMORY): Remove. * auto-profile.cc (INCLUDE_MEMORY): Remove. * calls.cc (INCLUDE_MEMORY): Remove. * cfganal.cc (INCLUDE_MEMORY): Remove. * cfgexpand.cc (INCLUDE_MEMORY): Remove. * cfghooks.cc (INCLUDE_MEMORY): Remove. * cfgloop.cc (INCLUDE_MEMORY): Remove. * cgraph.cc (INCLUDE_MEMORY): Remove. * cgraphclones.cc (INCLUDE_MEMORY): Remove. * cgraphunit.cc (INCLUDE_MEMORY): Remove. * collect-utils.cc (INCLUDE_MEMORY): Remove. * collect2.cc (INCLUDE_MEMORY): Remove. * common/config/aarch64/aarch64-common.cc (INCLUDE_MEMORY): Remove. * common/config/arm/arm-common.cc (INCLUDE_MEMORY): Remove. * common/config/avr/avr-common.cc (INCLUDE_MEMORY): Remove. * config/aarch64/aarch64-cc-fusion.cc (INCLUDE_MEMORY): Remove. * config/aarch64/aarch64-early-ra.cc (INCLUDE_MEMORY): Remove. * config/aarch64/aarch64-sve-builtins.cc (INCLUDE_MEMORY): Remove. * config/aarch64/aarch64.cc (INCLUDE_MEMORY): Remove. * config/arc/arc.cc (INCLUDE_MEMORY): Remove. * config/arm/aarch-common.cc (INCLUDE_MEMORY) Remove.: * config/arm/arm-mve-builtins.cc (INCLUDE_MEMORY): Remove. * config/arm/arm.cc (INCLUDE_MEMORY): Remove. * config/avr/avr-devices.cc (INCLUDE_MEMORY): Remove. * config/avr/driver-avr.cc (INCLUDE_MEMORY): Remove. * config/bpf/bpf.cc (INCLUDE_MEMORY): Remove. * config/bpf/btfext-out.cc (INCLUDE_MEMORY): Remove. * config/bpf/core-builtins.cc (INCLUDE_MEMORY): Remove. * config/darwin.cc (INCLUDE_MEMORY): Remove. * config/gcn/mkoffload.cc (INCLUDE_MEMORY): Remove. * config/i386/driver-i386.cc (INCLUDE_MEMORY): Remove. * config/i386/i386-builtins.cc (INCLUDE_MEMORY): Remove. * config/i386/i386-expand.cc (INCLUDE_MEMORY): Remove. * config/i386/i386-features.cc (INCLUDE_MEMORY): Remove. * config/i386/i386-options.cc (INCLUDE_MEMORY): Remove. * config/i386/i386.cc (INCLUDE_MEMORY): Remove. * config/loongarch/loongarch-builtins.cc (INCLUDE_MEMORY): Remove. * config/loongarch/loongarch.cc (INCLUDE_MEMORY): Remove. * config/mingw/winnt-cxx.cc (INCLUDE_MEMORY): Remove. * config/mingw/winnt.cc (INCLUDE_MEMORY): Remove. * config/mips/mips.cc (INCLUDE_MEMORY): Remove. * config/msp430/driver-msp430.cc (INCLUDE_MEMORY): Remove. * config/nvptx/mkoffload.cc (INCLUDE_MEMORY): Remove. * config/nvptx/nvptx.cc (INCLUDE_MEMORY): Remove. * config/riscv/riscv-avlprop.cc (INCLUDE_MEMORY): Remove. * config/riscv/riscv-target-attr.cc (INCLUDE_MEMORY): Remove. * config/riscv/riscv-vector-builtins.cc (INCLUDE_MEMORY): Remove. * config/riscv/riscv-vector-costs.cc (INCLUDE_MEMORY): Remove. * config/riscv/riscv-vsetvl.cc (INCLUDE_MEMORY): Remove. * config/riscv/riscv.cc (INCLUDE_MEMORY): Remove. * config/rs6000/driver-rs6000.cc (INCLUDE_MEMORY): Remove. * config/rs6000/host-darwin.cc (INCLUDE_MEMORY): Remove. * config/rs6000/rs6000-c.cc (INCLUDE_MEMORY): Remove. * config/rs6000/rs6000.cc (INCLUDE_MEMORY): Remove. * config/s390/s390-c.cc (INCLUDE_MEMORY): Remove. * config/s390/s390.cc (INCLUDE_MEMORY): Remove. * config/sol2-cxx.cc (INCLUDE_MEMORY): Remove. * config/vms/vms-c.cc (INCLUDE_MEMORY): Remove. * config/xtensa/xtensa-dynconfig.cc (INCLUDE_MEMORY): Remove. * coroutine-passes.cc (INCLUDE_MEMORY): Remove. * coverage.cc (INCLUDE_MEMORY): Remove. * data-streamer-in.cc (INCLUDE_MEMORY): Remove. * data-streamer-out.cc (INCLUDE_MEMORY): Remove. * data-streamer.cc (INCLUDE_MEMORY): Remove. * diagnostic-format-json.cc (INCLUDE_MEMORY): Remove. * diagnostic-format-sarif.cc (INCLUDE_MEMORY): Remove. * diagnostic-format-text.cc (INCLUDE_MEMORY): Remove. * diagnostic-global-context.cc (INCLUDE_MEMORY): Remove. * diagnostic-macro-unwinding.cc (INCLUDE_MEMORY): Remove. * diagnostic-path.cc (INCLUDE_MEMORY): Remove. * diagnostic-show-locus.cc (INCLUDE_MEMORY): Remove. * diagnostic-spec.cc (INCLUDE_MEMORY): Remove. * diagnostic.cc (INCLUDE_MEMORY): Remove. * diagnostic.h: Remove check for INCLUDE_MEMORY. * digraph.cc (INCLUDE_MEMORY): Remove. * dumpfile.cc (INCLUDE_MEMORY): Remove. * dwarf2out.cc (INCLUDE_MEMORY): Remove. * edit-context.cc (INCLUDE_MEMORY): Remove. * except.cc (INCLUDE_MEMORY): Remove. * expr.cc (INCLUDE_MEMORY): Remove. * file-prefix-map.cc (INCLUDE_MEMORY): Remove. * final.cc (INCLUDE_MEMORY): Remove. * fwprop.cc (INCLUDE_MEMORY): Remove. * gcc-plugin.h (INCLUDE_MEMORY): Remove. * gcc-rich-location.cc (INCLUDE_MEMORY): Remove. * gcc-urlifier.cc (INCLUDE_MEMORY): Remove. * gcc.cc (INCLUDE_MEMORY): Remove. * gcov-dump.cc (INCLUDE_MEMORY): Remove. * gcov-tool.cc (INCLUDE_MEMORY): Remove. * gcov.cc (INCLUDE_MEMORY): Remove. * gengtype.cc (open_base_files): Don't print `#define INCLUDE_MEMORY`. * genmatch.cc (INCLUDE_MEMORY): Remove. * gimple-fold.cc (INCLUDE_MEMORY): Remove. * gimple-harden-conditionals.cc (INCLUDE_MEMORY): Remove. * gimple-harden-control-flow.cc (INCLUDE_MEMORY): Remove. * gimple-if-to-switch.cc (INCLUDE_MEMORY): Remove. * gimple-loop-interchange.cc (INCLUDE_MEMORY): Remove. * gimple-loop-jam.cc (INCLUDE_MEMORY): Remove. * gimple-loop-versioning.cc (INCLUDE_MEMORY): Remove. * gimple-lower-bitint.cc (INCLUDE_MEMORY): Remove. * gimple-predicate-analysis.cc (INCLUDE_MEMORY): Remove. * gimple-pretty-print.cc (INCLUDE_MEMORY): Remove. * gimple-range-cache.cc (INCLUDE_MEMORY): Remove. * gimple-range-edge.cc (INCLUDE_MEMORY): Remove. * gimple-range-fold.cc (INCLUDE_MEMORY): Remove. * gimple-range-gori.cc (INCLUDE_MEMORY): Remove. * gimple-range-infer.cc (INCLUDE_MEMORY): Remove. * gimple-range-op.cc (INCLUDE_MEMORY): Remove. * gimple-range-path.cc (INCLUDE_MEMORY): Remove. * gimple-range-phi.cc (INCLUDE_MEMORY): Remove. * gimple-range-trace.cc (INCLUDE_MEMORY): Remove. * gimple-range.cc (INCLUDE_MEMORY): Remove. * gimple-ssa-backprop.cc (INCLUDE_MEMORY): Remove. * gimple-ssa-sprintf.cc (INCLUDE_MEMORY): Remove. * gimple-ssa-store-merging.cc (INCLUDE_MEMORY): Remove. * gimple-ssa-strength-reduction.cc (INCLUDE_MEMORY): Remove. * gimple-ssa-warn-access.cc (INCLUDE_MEMORY): Remove. * gimple-ssa-warn-alloca.cc (INCLUDE_MEMORY): Remove. * gimple-ssa-warn-restrict.cc (INCLUDE_MEMORY): Remove. * gimple-streamer-in.cc (INCLUDE_MEMORY): Remove. * gimple-streamer-out.cc (INCLUDE_MEMORY): Remove. * gimple.cc (INCLUDE_MEMORY): Remove. * gimplify.cc (INCLUDE_MEMORY): Remove. * graph.cc (INCLUDE_MEMORY): Remove. * graphite-dependences.cc (INCLUDE_MEMORY): Remove. * graphite-isl-ast-to-gimple.cc (INCLUDE_MEMORY): Remove. * graphite-optimize-isl.cc (INCLUDE_MEMORY): Remove. * graphite-poly.cc (INCLUDE_MEMORY): Remove. * graphite-scop-detection.cc (INCLUDE_MEMORY): Remove. * graphite-sese-to-poly.cc (INCLUDE_MEMORY): Remove. * graphite.cc (INCLUDE_MEMORY): Remove. * graphviz.cc (INCLUDE_MEMORY): Remove. * input.cc (INCLUDE_MEMORY): Remove. * ipa-cp.cc (INCLUDE_MEMORY): Remove. * ipa-devirt.cc (INCLUDE_MEMORY): Remove. * ipa-fnsummary.cc (INCLUDE_MEMORY): Remove. * ipa-free-lang-data.cc (INCLUDE_MEMORY): Remove. * ipa-icf-gimple.cc (INCLUDE_MEMORY): Remove. * ipa-icf.cc (INCLUDE_MEMORY): Remove. * ipa-inline-analysis.cc (INCLUDE_MEMORY): Remove. * ipa-inline.cc (INCLUDE_MEMORY): Remove. * ipa-modref-tree.cc (INCLUDE_MEMORY): Remove. * ipa-modref.cc (INCLUDE_MEMORY): Remove. * ipa-param-manipulation.cc (INCLUDE_MEMORY): Remove. * ipa-polymorphic-call.cc (INCLUDE_MEMORY): Remove. * ipa-predicate.cc (INCLUDE_MEMORY): Remove. * ipa-profile.cc (INCLUDE_MEMORY): Remove. * ipa-prop.cc (INCLUDE_MEMORY): Remove. * ipa-pure-const.cc (INCLUDE_MEMORY): Remove. * ipa-reference.cc (INCLUDE_MEMORY): Remove. * ipa-split.cc (INCLUDE_MEMORY): Remove. * ipa-sra.cc (INCLUDE_MEMORY): Remove. * ipa-strub.cc (INCLUDE_MEMORY): Remove. * ipa-utils.cc (INCLUDE_MEMORY): Remove. * json-parsing.cc (INCLUDE_MEMORY): Remove. * json.cc (INCLUDE_MEMORY): Remove. * json.h: Don't check INCLUDE_MEMORY. * langhooks.cc (INCLUDE_MEMORY): Remove. * late-combine.cc (INCLUDE_MEMORY): Remove. * lazy-diagnostic-path.cc (INCLUDE_MEMORY): Remove. * libdiagnostics.cc (INCLUDE_MEMORY): Remove. * libsarifreplay.cc (INCLUDE_MEMORY): Remove. * lto-cgraph.cc (INCLUDE_MEMORY): Remove. * lto-compress.cc (INCLUDE_MEMORY): Remove. * lto-opts.cc (INCLUDE_MEMORY): Remove. * lto-section-in.cc (INCLUDE_MEMORY): Remove. * lto-section-out.cc (INCLUDE_MEMORY): Remove. * lto-streamer-in.cc (INCLUDE_MEMORY): Remove. * lto-streamer-out.cc (INCLUDE_MEMORY): Remove. * lto-streamer.cc (INCLUDE_MEMORY): Remove. * lto-wrapper.cc (INCLUDE_MEMORY): Remove. * make-unique.h (GCC_MAKE_UNIQUE): Remove. * multiple_target.cc (INCLUDE_MEMORY): Remove. * omp-expand.cc (INCLUDE_MEMORY): Remove. * omp-general.cc (INCLUDE_MEMORY): Remove. * omp-low.cc (INCLUDE_MEMORY): Remove. * omp-oacc-neuter-broadcast.cc (INCLUDE_MEMORY): Remove. * omp-offload.cc (INCLUDE_MEMORY): Remove. * omp-simd-clone.cc (INCLUDE_MEMORY): Remove. * opt-problem.cc (INCLUDE_MEMORY): Remove. * optinfo-emit-json.cc (INCLUDE_MEMORY): Remove. * optinfo.cc (INCLUDE_MEMORY): Remove. * optinfo.h: Don't check INCLUDE_MEMORY. * opts-common.cc (INCLUDE_MEMORY): Remove. * opts-diagnostic.cc (INCLUDE_MEMORY): Remove. * opts-global.cc (INCLUDE_MEMORY): Remove. * opts.cc (INCLUDE_MEMORY): Remove. * pair-fusion.cc (INCLUDE_MEMORY): Remove. * passes.cc (INCLUDE_MEMORY): Remove. * pointer-query.cc (INCLUDE_MEMORY): Remove. * predict.cc (INCLUDE_MEMORY): Remove. * pretty-print.cc (INCLUDE_MEMORY): Remove. * pretty-print.h: Don't check INCLUDE_MEMORY. * print-rtl.cc (INCLUDE_MEMORY): Remove. * print-tree.cc (INCLUDE_MEMORY): Remove. * profile-count.cc (INCLUDE_MEMORY): Remove. * range-op-float.cc (INCLUDE_MEMORY): Remove. * range-op-ptr.cc (INCLUDE_MEMORY): Remove. * range-op.cc (INCLUDE_MEMORY): Remove. * range.cc (INCLUDE_MEMORY): Remove. * read-rtl-function.cc (INCLUDE_MEMORY): Remove. * rtl-error.cc (INCLUDE_MEMORY): Remove. * rtl-ssa/accesses.cc (INCLUDE_MEMORY): Remove. * rtl-ssa/blocks.cc (INCLUDE_MEMORY): Remove. * rtl-ssa/changes.cc (INCLUDE_MEMORY): Remove. * rtl-ssa/functions.cc (INCLUDE_MEMORY): Remove. * rtl-ssa/insns.cc (INCLUDE_MEMORY): Remove. * rtl-ssa/movement.cc (INCLUDE_MEMORY): Remove. * rtl-tests.cc (INCLUDE_MEMORY): Remove. * sanopt.cc (INCLUDE_MEMORY): Remove. * sched-rgn.cc (INCLUDE_MEMORY): Remove. * selftest-diagnostic-path.cc (INCLUDE_MEMORY): Remove. * selftest-diagnostic.cc (INCLUDE_MEMORY): Remove. * selftest-json.cc (INCLUDE_MEMORY): Remove. * sese.cc (INCLUDE_MEMORY): Remove. * simple-diagnostic-path.cc (INCLUDE_MEMORY): Remove. * splay-tree-utils.cc (INCLUDE_MEMORY): Remove. * sreal.cc (INCLUDE_MEMORY): Remove. * stmt.cc (INCLUDE_MEMORY): Remove. * substring-locations.cc (INCLUDE_MEMORY): Remove. * symtab-clones.cc (INCLUDE_MEMORY): Remove. * symtab-thunks.cc (INCLUDE_MEMORY): Remove. * symtab.cc (INCLUDE_MEMORY): Remove. * system.h: Include memory unconditionally for C++. Also remove support for INCLUDE_MEMORY. * targhooks.cc (INCLUDE_MEMORY): Remove. * text-art/box-drawing.cc (INCLUDE_MEMORY): Remove. * text-art/canvas.cc (INCLUDE_MEMORY): Remove. * text-art/ruler.cc (INCLUDE_MEMORY): Remove. * text-art/selftests.cc (INCLUDE_MEMORY): Remove. * text-art/style.cc (INCLUDE_MEMORY): Remove. * text-art/styled-string.cc (INCLUDE_MEMORY): Remove. * text-art/table.cc (INCLUDE_MEMORY): Remove. * text-art/theme.cc (INCLUDE_MEMORY): Remove. * text-art/tree-widget.cc (INCLUDE_MEMORY): Remove. * text-art/widget.cc (INCLUDE_MEMORY): Remove. * timevar.cc (INCLUDE_MEMORY): Remove. * toplev.cc (INCLUDE_MEMORY): Remove. * trans-mem.cc (INCLUDE_MEMORY): Remove. * tree-affine.cc (INCLUDE_MEMORY): Remove. * tree-assume.cc (INCLUDE_MEMORY): Remove. * tree-call-cdce.cc (INCLUDE_MEMORY): Remove. * tree-cfg.cc (INCLUDE_MEMORY): Remove. * tree-chrec.cc (INCLUDE_MEMORY): Remove. * tree-data-ref.cc (INCLUDE_MEMORY): Remove. * tree-dfa.cc (INCLUDE_MEMORY): Remove. * tree-diagnostic-client-data-hooks.cc (INCLUDE_MEMORY): Remove. * tree-diagnostic.cc (INCLUDE_MEMORY): Remove. * tree-dump.cc (INCLUDE_MEMORY): Remove. * tree-if-conv.cc (INCLUDE_MEMORY): Remove. * tree-inline.cc (INCLUDE_MEMORY): Remove. * tree-into-ssa.cc (INCLUDE_MEMORY): Remove. * tree-logical-location.cc (INCLUDE_MEMORY): Remove. * tree-loop-distribution.cc (INCLUDE_MEMORY): Remove. * tree-nested.cc (INCLUDE_MEMORY): Remove. * tree-nrv.cc (INCLUDE_MEMORY): Remove. * tree-object-size.cc (INCLUDE_MEMORY): Remove. * tree-outof-ssa.cc (INCLUDE_MEMORY): Remove. * tree-parloops.cc (INCLUDE_MEMORY): Remove. * tree-predcom.cc (INCLUDE_MEMORY): Remove. * tree-pretty-print.cc (INCLUDE_MEMORY): Remove. * tree-profile.cc (INCLUDE_MEMORY): Remove. * tree-scalar-evolution.cc (INCLUDE_MEMORY): Remove. * tree-sra.cc (INCLUDE_MEMORY): Remove. * tree-ssa-address.cc (INCLUDE_MEMORY): Remove. * tree-ssa-alias.cc (INCLUDE_MEMORY): Remove. * tree-ssa-ccp.cc (INCLUDE_MEMORY): Remove. * tree-ssa-coalesce.cc (INCLUDE_MEMORY): Remove. * tree-ssa-copy.cc (INCLUDE_MEMORY): Remove. * tree-ssa-dce.cc (INCLUDE_MEMORY): Remove. * tree-ssa-dom.cc (INCLUDE_MEMORY): Remove. * tree-ssa-dse.cc (INCLUDE_MEMORY): Remove. * tree-ssa-forwprop.cc (INCLUDE_MEMORY): Remove. * tree-ssa-ifcombine.cc (INCLUDE_MEMORY): Remove. * tree-ssa-live.cc (INCLUDE_MEMORY): Remove. * tree-ssa-loop-ch.cc (INCLUDE_MEMORY): Remove. * tree-ssa-loop-im.cc (INCLUDE_MEMORY): Remove. * tree-ssa-loop-ivcanon.cc (INCLUDE_MEMORY): Remove. * tree-ssa-loop-ivopts.cc (INCLUDE_MEMORY): Remove. * tree-ssa-loop-manip.cc (INCLUDE_MEMORY): Remove. * tree-ssa-loop-niter.cc (INCLUDE_MEMORY): Remove. * tree-ssa-loop-prefetch.cc (INCLUDE_MEMORY): Remove. * tree-ssa-loop-split.cc (INCLUDE_MEMORY): Remove. * tree-ssa-loop-unswitch.cc (INCLUDE_MEMORY): Remove. * tree-ssa-math-opts.cc (INCLUDE_MEMORY): Remove. * tree-ssa-operands.cc (INCLUDE_MEMORY): Remove. * tree-ssa-phiopt.cc (INCLUDE_MEMORY): Remove. * tree-ssa-phiprop.cc (INCLUDE_MEMORY): Remove. * tree-ssa-pre.cc (INCLUDE_MEMORY): Remove. * tree-ssa-propagate.cc (INCLUDE_MEMORY): Remove. * tree-ssa-reassoc.cc (INCLUDE_MEMORY): Remove. * tree-ssa-sccvn.cc (INCLUDE_MEMORY): Remove. * tree-ssa-scopedtables.cc (INCLUDE_MEMORY): Remove. * tree-ssa-sink.cc (INCLUDE_MEMORY): Remove. * tree-ssa-strlen.cc (INCLUDE_MEMORY): Remove. * tree-ssa-structalias.cc (INCLUDE_MEMORY): Remove. * tree-ssa-ter.cc (INCLUDE_MEMORY): Remove. * tree-ssa-threadbackward.cc (INCLUDE_MEMORY): Remove. * tree-ssa-threadupdate.cc (INCLUDE_MEMORY): Remove. * tree-ssa-uninit.cc (INCLUDE_MEMORY): Remove. * tree-ssa.cc (INCLUDE_MEMORY): Remove. * tree-ssanames.cc (INCLUDE_MEMORY): Remove. * tree-stdarg.cc (INCLUDE_MEMORY): Remove. * tree-streamer-in.cc (INCLUDE_MEMORY): Remove. * tree-streamer-out.cc (INCLUDE_MEMORY): Remove. * tree-streamer.cc (INCLUDE_MEMORY): Remove. * tree-switch-conversion.cc (INCLUDE_MEMORY): Remove. * tree-tailcall.cc (INCLUDE_MEMORY): Remove. * tree-vect-data-refs.cc (INCLUDE_MEMORY): Remove. * tree-vect-generic.cc (INCLUDE_MEMORY): Remove. * tree-vect-loop-manip.cc (INCLUDE_MEMORY): Remove. * tree-vect-loop.cc (INCLUDE_MEMORY): Remove. * tree-vect-patterns.cc (INCLUDE_MEMORY): Remove. * tree-vect-slp-patterns.cc (INCLUDE_MEMORY): Remove. * tree-vect-slp.cc (INCLUDE_MEMORY): Remove. * tree-vect-stmts.cc (INCLUDE_MEMORY): Remove. * tree-vectorizer.cc (INCLUDE_MEMORY): Remove. * tree-vrp.cc (INCLUDE_MEMORY): Remove. * tree.cc (INCLUDE_MEMORY): Remove. * ubsan.cc (INCLUDE_MEMORY): Remove. * value-pointer-equiv.cc (INCLUDE_MEMORY): Remove. * value-prof.cc (INCLUDE_MEMORY): Remove. * value-query.cc (INCLUDE_MEMORY): Remove. * value-range-pretty-print.cc (INCLUDE_MEMORY): Remove. * value-range-storage.cc (INCLUDE_MEMORY): Remove. * value-range.cc (INCLUDE_MEMORY): Remove. * value-relation.cc (INCLUDE_MEMORY): Remove. * var-tracking.cc (INCLUDE_MEMORY): Remove. * varpool.cc (INCLUDE_MEMORY): Remove. * vr-values.cc (INCLUDE_MEMORY): Remove. * wide-int-print.cc (INCLUDE_MEMORY): Remove. gcc/c-family/ChangeLog: * c-ada-spec.cc (INCLUDE_MEMORY): Remove. * c-attribs.cc (INCLUDE_MEMORY): Remove. * c-common.cc (INCLUDE_MEMORY): Remove. * c-format.cc (INCLUDE_MEMORY): Remove. * c-gimplify.cc (INCLUDE_MEMORY): Remove. * c-indentation.cc (INCLUDE_MEMORY): Remove. * c-opts.cc (INCLUDE_MEMORY): Remove. * c-pch.cc (INCLUDE_MEMORY): Remove. * c-pragma.cc (INCLUDE_MEMORY): Remove. * c-pretty-print.cc (INCLUDE_MEMORY): Remove. * c-type-mismatch.cc (INCLUDE_MEMORY): Remove. * c-warn.cc (INCLUDE_MEMORY): Remove. * known-headers.cc (INCLUDE_MEMORY): Remove. * name-hint.h: Remove check of INCLUDE_MEMORY. gcc/c/ChangeLog: * c-aux-info.cc (INCLUDE_MEMORY): Remove. * c-convert.cc (INCLUDE_MEMORY): Remove. * c-decl.cc (INCLUDE_MEMORY): Remove. * c-errors.cc (INCLUDE_MEMORY): Remove. * c-fold.cc (INCLUDE_MEMORY): Remove. * c-lang.cc (INCLUDE_MEMORY): Remove. * c-objc-common.cc (INCLUDE_MEMORY): Remove. * c-parser.cc (INCLUDE_MEMORY): Remove. * c-typeck.cc (INCLUDE_MEMORY): Remove. * gimple-parser.cc (INCLUDE_MEMORY): Remove. gcc/cp/ChangeLog: * call.cc (INCLUDE_MEMORY): Remove. * class.cc (INCLUDE_MEMORY): Remove. * constexpr.cc (INCLUDE_MEMORY): Remove. * constraint.cc (INCLUDE_MEMORY): Remove. * contracts.cc (INCLUDE_MEMORY): Remove. * coroutines.cc (INCLUDE_MEMORY): Remove. * cp-gimplify.cc (INCLUDE_MEMORY): Remove. * cp-lang.cc (INCLUDE_MEMORY): Remove. * cp-objcp-common.cc (INCLUDE_MEMORY): Remove. * cp-ubsan.cc (INCLUDE_MEMORY): Remove. * cvt.cc (INCLUDE_MEMORY): Remove. * cxx-pretty-print.cc (INCLUDE_MEMORY): Remove. * decl.cc (INCLUDE_MEMORY): Remove. * decl2.cc (INCLUDE_MEMORY): Remove. * dump.cc (INCLUDE_MEMORY): Remove. * error.cc (INCLUDE_MEMORY): Remove. * except.cc (INCLUDE_MEMORY): Remove. * expr.cc (INCLUDE_MEMORY): Remove. * friend.cc (INCLUDE_MEMORY): Remove. * init.cc (INCLUDE_MEMORY): Remove. * lambda.cc (INCLUDE_MEMORY): Remove. * lex.cc (INCLUDE_MEMORY): Remove. * logic.cc (INCLUDE_MEMORY): Remove. * mangle.cc (INCLUDE_MEMORY): Remove. * mapper-client.cc (INCLUDE_MEMORY): Remove. * mapper-resolver.cc (INCLUDE_MEMORY): Remove. * method.cc (INCLUDE_MEMORY): Remove. * module.cc (INCLUDE_MEMORY): Remove. * name-lookup.cc (INCLUDE_MEMORY): Remove. * optimize.cc (INCLUDE_MEMORY): Remove. * parser.cc (INCLUDE_MEMORY): Remove. * pt.cc (INCLUDE_MEMORY): Remove. * ptree.cc (INCLUDE_MEMORY): Remove. * rtti.cc (INCLUDE_MEMORY): Remove. * search.cc (INCLUDE_MEMORY): Remove. * semantics.cc (INCLUDE_MEMORY): Remove. * tree.cc (INCLUDE_MEMORY): Remove. * typeck.cc (INCLUDE_MEMORY): Remove. * typeck2.cc (INCLUDE_MEMORY): Remove. * vtable-class-hierarchy.cc (INCLUDE_MEMORY): Remove. gcc/d/ChangeLog: * d-attribs.cc (INCLUDE_MEMORY): Remove. * d-builtins.cc (INCLUDE_MEMORY): Remove. * d-codegen.cc (INCLUDE_MEMORY): Remove. * d-convert.cc (INCLUDE_MEMORY): Remove. * d-diagnostic.cc (INCLUDE_MEMORY): Remove. * d-frontend.cc (INCLUDE_MEMORY): Remove. * d-lang.cc (INCLUDE_MEMORY): Remove. * d-longdouble.cc (INCLUDE_MEMORY): Remove. * d-target.cc (INCLUDE_MEMORY): Remove. * decl.cc (INCLUDE_MEMORY): Remove. * expr.cc (INCLUDE_MEMORY): Remove. * intrinsics.cc (INCLUDE_MEMORY): Remove. * modules.cc (INCLUDE_MEMORY): Remove. * toir.cc (INCLUDE_MEMORY): Remove. * typeinfo.cc (INCLUDE_MEMORY): Remove. * types.cc (INCLUDE_MEMORY): Remove. gcc/fortran/ChangeLog: * arith.cc (INCLUDE_MEMORY): Remove. * array.cc (INCLUDE_MEMORY): Remove. * bbt.cc (INCLUDE_MEMORY): Remove. * check.cc (INCLUDE_MEMORY): Remove. * class.cc (INCLUDE_MEMORY): Remove. * constructor.cc (INCLUDE_MEMORY): Remove. * convert.cc (INCLUDE_MEMORY): Remove. * cpp.cc (INCLUDE_MEMORY): Remove. * data.cc (INCLUDE_MEMORY): Remove. * decl.cc (INCLUDE_MEMORY): Remove. * dependency.cc (INCLUDE_MEMORY): Remove. * dump-parse-tree.cc (INCLUDE_MEMORY): Remove. * error.cc (INCLUDE_MEMORY): Remove. * expr.cc (INCLUDE_MEMORY): Remove. * f95-lang.cc (INCLUDE_MEMORY): Remove. * frontend-passes.cc (INCLUDE_MEMORY): Remove. * interface.cc (INCLUDE_MEMORY): Remove. * intrinsic.cc (INCLUDE_MEMORY): Remove. * io.cc (INCLUDE_MEMORY): Remove. * iresolve.cc (INCLUDE_MEMORY): Remove. * match.cc (INCLUDE_MEMORY): Remove. * matchexp.cc (INCLUDE_MEMORY): Remove. * misc.cc (INCLUDE_MEMORY): Remove. * module.cc (INCLUDE_MEMORY): Remove. * openmp.cc (INCLUDE_MEMORY): Remove. * options.cc (INCLUDE_MEMORY): Remove. * parse.cc (INCLUDE_MEMORY): Remove. * primary.cc (INCLUDE_MEMORY): Remove. * resolve.cc (INCLUDE_MEMORY): Remove. * scanner.cc (INCLUDE_MEMORY): Remove. * simplify.cc (INCLUDE_MEMORY): Remove. * st.cc (INCLUDE_MEMORY): Remove. * symbol.cc (INCLUDE_MEMORY): Remove. * target-memory.cc (INCLUDE_MEMORY): Remove. * trans-array.cc (INCLUDE_MEMORY): Remove. * trans-common.cc (INCLUDE_MEMORY): Remove. * trans-const.cc (INCLUDE_MEMORY): Remove. * trans-decl.cc (INCLUDE_MEMORY): Remove. * trans-expr.cc (INCLUDE_MEMORY): Remove. * trans-intrinsic.cc (INCLUDE_MEMORY): Remove. * trans-io.cc (INCLUDE_MEMORY): Remove. * trans-openmp.cc (INCLUDE_MEMORY): Remove. * trans-stmt.cc (INCLUDE_MEMORY): Remove. * trans-types.cc (INCLUDE_MEMORY): Remove. * trans.cc (INCLUDE_MEMORY): Remove. gcc/go/ChangeLog: * go-backend.cc (INCLUDE_MEMORY): Remove. * go-lang.cc (INCLUDE_MEMORY): Remove. gcc/jit/ChangeLog: * dummy-frontend.cc (INCLUDE_MEMORY): Remove. * jit-playback.cc (INCLUDE_MEMORY): Remove. * jit-recording.cc (INCLUDE_MEMORY): Remove. gcc/lto/ChangeLog: * lto-common.cc (INCLUDE_MEMORY): Remove. * lto-dump.cc (INCLUDE_MEMORY): Remove. * lto-partition.cc (INCLUDE_MEMORY): Remove. * lto-symtab.cc (INCLUDE_MEMORY): Remove. * lto.cc (INCLUDE_MEMORY): Remove. gcc/m2/ChangeLog: * gm2-gcc/gcc-consolidation.h (INCLUDE_MEMORY): Remove. * gm2-gcc/m2configure.cc (INCLUDE_MEMORY): Remove. * mc-boot/GASCII.cc (INCLUDE_MEMORY): Remove. * mc-boot/GASCII.h (INCLUDE_MEMORY): Remove. * mc-boot/GArgs.cc (INCLUDE_MEMORY): Remove. * mc-boot/GArgs.h (INCLUDE_MEMORY): Remove. * mc-boot/GAssertion.cc (INCLUDE_MEMORY): Remove. * mc-boot/GAssertion.h (INCLUDE_MEMORY): Remove. * mc-boot/GBreak.cc (INCLUDE_MEMORY): Remove. * mc-boot/GBreak.h (INCLUDE_MEMORY): Remove. * mc-boot/GCOROUTINES.h (INCLUDE_MEMORY): Remove. * mc-boot/GCmdArgs.cc (INCLUDE_MEMORY): Remove. * mc-boot/GCmdArgs.h (INCLUDE_MEMORY): Remove. * mc-boot/GDebug.cc (INCLUDE_MEMORY): Remove. * mc-boot/GDebug.h (INCLUDE_MEMORY): Remove. Remove. * mc-boot/GDynamicStrings.cc (INCLUDE_MEMORY): Remove. * mc-boot/GDynamicStrings.h (INCLUDE_MEMORY): Remove. * mc-boot/GEnvironment.cc (INCLUDE_MEMORY): Remove. * mc-boot/GEnvironment.h (INCLUDE_MEMORY): Remove. * mc-boot/GFIO.cc (INCLUDE_MEMORY): Remove. * mc-boot/GFIO.h (INCLUDE_MEMORY): Remove. * mc-boot/GFormatStrings.cc (INCLUDE_MEMORY): Remove. * mc-boot/GFormatStrings.h (INCLUDE_MEMORY): Remove. * mc-boot/GFpuIO.cc (INCLUDE_MEMORY): Remove. * mc-boot/GFpuIO.h (INCLUDE_MEMORY): Remove. * mc-boot/GIO.cc (INCLUDE_MEMORY): Remove. * mc-boot/GIO.h (INCLUDE_MEMORY): Remove. * mc-boot/GIndexing.cc (INCLUDE_MEMORY): Remove. * mc-boot/GIndexing.h (INCLUDE_MEMORY): Remove. * mc-boot/GM2Dependent.cc (INCLUDE_MEMORY): Remove. * mc-boot/GM2Dependent.h (INCLUDE_MEMORY): Remove. * mc-boot/GM2EXCEPTION.cc (INCLUDE_MEMORY): Remove. * mc-boot/GM2EXCEPTION.h (INCLUDE_MEMORY): Remove. * mc-boot/GM2RTS.cc (INCLUDE_MEMORY): Remove. * mc-boot/GM2RTS.h (INCLUDE_MEMORY): Remove. Remove. * mc-boot/GMemUtils.cc (INCLUDE_MEMORY): Remove. * mc-boot/GMemUtils.h (INCLUDE_MEMORY): Remove. * mc-boot/GNumberIO.cc (INCLUDE_MEMORY): Remove. * mc-boot/GNumberIO.h (INCLUDE_MEMORY): Remove. * mc-boot/GPushBackInput.cc (INCLUDE_MEMORY): Remove. * mc-boot/GPushBackInput.h (INCLUDE_MEMORY): Remove. * mc-boot/GRTExceptions.cc (INCLUDE_MEMORY): Remove. * mc-boot/GRTExceptions.h (INCLUDE_MEMORY): Remove. * mc-boot/GRTco.h (INCLUDE_MEMORY): Remove. * mc-boot/GRTentity.h (INCLUDE_MEMORY): Remove. * mc-boot/GRTint.cc (INCLUDE_MEMORY): Remove. * mc-boot/GRTint.h (INCLUDE_MEMORY): Remove. * mc-boot/GSArgs.cc (INCLUDE_MEMORY): Remove. * mc-boot/GSArgs.h (INCLUDE_MEMORY): Remove. * mc-boot/GSFIO.cc (INCLUDE_MEMORY): Remove. * mc-boot/GSFIO.h (INCLUDE_MEMORY): Remove. * mc-boot/GSYSTEM.h (INCLUDE_MEMORY): Remove. * mc-boot/GSelective.h (INCLUDE_MEMORY): Remove. * mc-boot/GStdIO.cc (INCLUDE_MEMORY): Remove. * mc-boot/GStdIO.h (INCLUDE_MEMORY): Remove. * mc-boot/GStorage.cc (INCLUDE_MEMORY): Remove. * mc-boot/GStorage.h (INCLUDE_MEMORY): Remove. * mc-boot/GStrCase.cc (INCLUDE_MEMORY): Remove. * mc-boot/GStrCase.h (INCLUDE_MEMORY): Remove. * mc-boot/GStrIO.cc (INCLUDE_MEMORY): Remove. * mc-boot/GStrIO.h (INCLUDE_MEMORY): Remove. * mc-boot/GStrLib.cc (INCLUDE_MEMORY): Remove. * mc-boot/GStrLib.h (INCLUDE_MEMORY): Remove. * mc-boot/GStringConvert.cc (INCLUDE_MEMORY): Remove. * mc-boot/GStringConvert.h (INCLUDE_MEMORY): Remove. * mc-boot/GSysExceptions.h (INCLUDE_MEMORY): Remove. * mc-boot/GSysStorage.cc (INCLUDE_MEMORY): Remove. * mc-boot/GSysStorage.h (INCLUDE_MEMORY): Remove. * mc-boot/GTimeString.cc (INCLUDE_MEMORY): Remove. * mc-boot/GTimeString.h (INCLUDE_MEMORY): Remove. * mc-boot/GUnixArgs.h (INCLUDE_MEMORY): Remove. * mc-boot/Galists.cc (INCLUDE_MEMORY): Remove. * mc-boot/Galists.h (INCLUDE_MEMORY): Remove. * mc-boot/Gdecl.cc (INCLUDE_MEMORY): Remove. * mc-boot/Gdecl.h (INCLUDE_MEMORY): Remove. * mc-boot/Gdtoa.h (INCLUDE_MEMORY): Remove. * mc-boot/Gerrno.h (INCLUDE_MEMORY): Remove. * mc-boot/Gkeyc.cc (INCLUDE_MEMORY): Remove. (checkGccConfigSystem): Remove printing out `#define INCLUDE_MEMORY`. * mc-boot/Gkeyc.h (INCLUDE_MEMORY): Remove. * mc-boot/Gldtoa.h (INCLUDE_MEMORY): Remove. * mc-boot/Glibc.h (INCLUDE_MEMORY): Remove. * mc-boot/Glibm.h (INCLUDE_MEMORY): Remove. * mc-boot/Glists.cc (INCLUDE_MEMORY): Remove. * mc-boot/Glists.h (INCLUDE_MEMORY): Remove. * mc-boot/GmcComment.cc (INCLUDE_MEMORY): Remove. * mc-boot/GmcComment.h (INCLUDE_MEMORY): Remove. * mc-boot/GmcComp.cc (INCLUDE_MEMORY): Remove. * mc-boot/GmcComp.h (INCLUDE_MEMORY): Remove. * mc-boot/GmcDebug.cc (INCLUDE_MEMORY): Remove. * mc-boot/GmcDebug.h (INCLUDE_MEMORY): Remove. * mc-boot/GmcError.cc (INCLUDE_MEMORY): Remove. * mc-boot/GmcError.h (INCLUDE_MEMORY): Remove. * mc-boot/GmcFileName.cc (INCLUDE_MEMORY): Remove. * mc-boot/GmcFileName.h (INCLUDE_MEMORY): Remove. * mc-boot/GmcLexBuf.cc (INCLUDE_MEMORY): Remove. * mc-boot/GmcLexBuf.h (INCLUDE_MEMORY): Remove. * mc-boot/GmcMetaError.cc (INCLUDE_MEMORY): Remove. * mc-boot/GmcMetaError.h (INCLUDE_MEMORY): Remove. * mc-boot/GmcOptions.cc (INCLUDE_MEMORY): Remove. * mc-boot/GmcOptions.h (INCLUDE_MEMORY): Remove. * mc-boot/GmcPreprocess.cc (INCLUDE_MEMORY): Remove. * mc-boot/GmcPreprocess.h (INCLUDE_MEMORY): Remove. * mc-boot/GmcPretty.cc (INCLUDE_MEMORY): Remove. * mc-boot/GmcPretty.h (INCLUDE_MEMORY): Remove. * mc-boot/GmcPrintf.cc (INCLUDE_MEMORY): Remove. * mc-boot/GmcPrintf.h (INCLUDE_MEMORY): Remove. * mc-boot/GmcQuiet.cc (INCLUDE_MEMORY): Remove. * mc-boot/GmcQuiet.h (INCLUDE_MEMORY): Remove. * mc-boot/GmcReserved.cc (INCLUDE_MEMORY): Remove. * mc-boot/GmcReserved.h (INCLUDE_MEMORY): Remove. * mc-boot/GmcSearch.cc (INCLUDE_MEMORY): Remove. * mc-boot/GmcSearch.h (INCLUDE_MEMORY): Remove. * mc-boot/GmcStack.cc (INCLUDE_MEMORY): Remove. * mc-boot/GmcStack.h (INCLUDE_MEMORY): Remove. * mc-boot/GmcStream.cc (INCLUDE_MEMORY): Remove. * mc-boot/GmcStream.h (INCLUDE_MEMORY): Remove. * mc-boot/Gmcflex.h (INCLUDE_MEMORY): Remove. * mc-boot/Gmcp1.cc (INCLUDE_MEMORY): Remove. * mc-boot/Gmcp1.h (INCLUDE_MEMORY): Remove. * mc-boot/Gmcp2.cc (INCLUDE_MEMORY): Remove. * mc-boot/Gmcp2.h (INCLUDE_MEMORY): Remove. * mc-boot/Gmcp3.cc (INCLUDE_MEMORY): Remove. * mc-boot/Gmcp3.h (INCLUDE_MEMORY): Remove. * mc-boot/Gmcp4.cc (INCLUDE_MEMORY): Remove. * mc-boot/Gmcp4.h (INCLUDE_MEMORY): Remove. * mc-boot/Gmcp5.cc (INCLUDE_MEMORY): Remove. * mc-boot/Gmcp5.h (INCLUDE_MEMORY): Remove. * mc-boot/GnameKey.cc (INCLUDE_MEMORY): Remove. * mc-boot/GnameKey.h (INCLUDE_MEMORY): Remove. * mc-boot/GsymbolKey.cc (INCLUDE_MEMORY): Remove. * mc-boot/GsymbolKey.h (INCLUDE_MEMORY): Remove. * mc-boot/Gtermios.h (INCLUDE_MEMORY): Remove. * mc-boot/Gtop.cc (INCLUDE_MEMORY): Remove. * mc-boot/Gvarargs.cc (INCLUDE_MEMORY): Remove. * mc-boot/Gvarargs.h (INCLUDE_MEMORY): Remove. * mc-boot/Gwlists.cc (INCLUDE_MEMORY): Remove. * mc-boot/Gwlists.h (INCLUDE_MEMORY): Remove. * mc-boot/Gwrapc.h (INCLUDE_MEMORY): Remove. * pge-boot/GIndexing.h (INCLUDE_MEMORY): Remove. * pge-boot/GSEnvironment.h (INCLUDE_MEMORY): Remove. * pge-boot/GScan.h (INCLUDE_MEMORY): Remove. gcc/objc/ChangeLog: * objc-act.cc (INCLUDE_MEMORY): Remove. * objc-encoding.cc (INCLUDE_MEMORY): Remove. * objc-gnu-runtime-abi-01.cc (INCLUDE_MEMORY): Remove. * objc-lang.cc (INCLUDE_MEMORY): Remove. * objc-next-runtime-abi-01.cc (INCLUDE_MEMORY): Remove. * objc-next-runtime-abi-02.cc (INCLUDE_MEMORY): Remove. * objc-runtime-shared-support.cc (INCLUDE_MEMORY): Remove. gcc/objcp/ChangeLog: * objcp-decl.cc (INCLUDE_MEMORY): Remove. * objcp-lang.cc (INCLUDE_MEMORY): Remove. gcc/rust/ChangeLog: * resolve/rust-ast-resolve-expr.cc (INCLUDE_MEMORY): Remove. * rust-attribs.cc (INCLUDE_MEMORY): Remove. * rust-system.h (INCLUDE_MEMORY): Remove. Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
2024-10-24Use unique_ptr in more places in pretty_printer/diagnostics [PR116613]David Malcolm2-0/+2
My forthcoming patches for PR other/116613 make much more use of cloning of pretty_printers than before, so it makes sense as a preliminary patch for the result of pretty_printer::clone to be a std::unique_ptr, rather than add more manual uses of "delete". On doing so, I noticed various other places where naked new/delete is used for run-time configuration of diagnostics: * the output format (text vs SARIF) * client data hooks * the option manager * the URLifier Hence this patch also makes use of std::unique_ptr and ::make_unique for managing such client policy classes, and also for diagnostic_buffer's per-format implementations. Unfortunately we can't directly include <memory> in our internal headers but instead any of our TUs that make use of std::unique_ptr must #define INCLUDE_MEMORY before including system.h. Hence the bulk of this patch is taken up with adding a define of INCLUDE_MEMORY to hundreds of source files: everything that includes diagnostic.h or pretty-print.h (and thus anything transitively such as includers of lto-wrapper.h, c-tree.h, cp-tree.h and rtl-ssa.h). Thanks to Gaius Mulley for the parts of the patch that regenerated the m2 files. gcc/ada/ChangeLog: PR other/116613 * gcc-interface/misc.cc: Add #define INCLUDE_MEMORY * gcc-interface/trans.cc: Likewise. * gcc-interface/utils.cc: Likewise. gcc/analyzer/ChangeLog: PR other/116613 * analyzer-logging.cc: Add #define INCLUDE_MEMORY (logger::logger): Update for m_pp becoming a unique_ptr. (logger::~logger): Likewise. (logger::log_va_partial): Likewise. (logger::end_log_line): Likewise. * analyzer-logging.h (logger::get_printer): Likewise. (logger::m_pp): Convert to a unique_ptr. * analyzer.cc (make_label_text): Use diagnostic_context::clone_printer and use unique_ptr. (make_label_text_n): Likewise. * bar-chart.cc: Add #define INCLUDE_MEMORY * pending-diagnostic.cc (evdesc::event_desc::formatted_print): Use diagnostic_context::clone_printer and use unique_ptr. * sm-malloc.cc (sufficiently_similar_p): Likewise. * supergraph.cc (supergraph::dump_dot_to_file): Likewise. gcc/c-family/ChangeLog: PR other/116613 * c-ada-spec.cc: Add #define INCLUDE_MEMORY. * c-attribs.cc: Likewise. * c-common.cc: Likewise. * c-format.cc: Likewise. * c-gimplify.cc: Likewise. * c-indentation.cc: Likewise. * c-opts.cc: Likewise. * c-pch.cc: Likewise. * c-pragma.cc: Likewise. * c-pretty-print.cc: Likewise. Add #include "make-unique.h". (c_pretty_printer::clone): Use std::unique_ptr and ::make_unique. * c-pretty-print.h (c_pretty_printer::clone): Use std::unique_ptr. * c-type-mismatch.cc: Add #define INCLUDE_MEMORY. * c-warn.cc: Likewise. gcc/c/ChangeLog: PR other/116613 * c-aux-info.cc: Add #define INCLUDE_MEMORY. * c-convert.cc: Likewise. * c-errors.cc: Likewise. * c-fold.cc: Likewise. * c-lang.cc: Likewise. * c-objc-common.cc: Likewise. (pp_markup::element_quoted_type::print_type): Use unique_ptr. * c-typeck.cc: Add #define INCLUDE_MEMORY. * gimple-parser.cc: Likewise. gcc/cp/ChangeLog: PR other/116613 * call.cc: Add #define INCLUDE_MEMORY. * class.cc: Likewise. * constexpr.cc: Likewise. * constraint.cc: Likewise. * contracts.cc: Likewise. * coroutines.cc: Likewise. * cp-gimplify.cc: Likewise. * cp-lang.cc: Likewise. * cp-objcp-common.cc: Likewise. * cp-ubsan.cc: Likewise. * cvt.cc: Likewise. * cxx-pretty-print.cc: Likewise. Add #include "cp-tree.h". (cxx_pretty_printer::clone): Use std::unique_ptr and ::make_unique. * cxx-pretty-print.h (cxx_pretty_printer::clone): Use std::unique_ptr. * decl2.cc: Add #define INCLUDE_MEMORY. * dump.cc: Likewise. * except.cc: Likewise. * expr.cc: Likewise. * friend.cc: Likewise. * init.cc: Likewise. * lambda.cc: Likewise. * logic.cc: Likewise. * mangle.cc: Likewise. * method.cc: Likewise. * optimize.cc: Likewise. * pt.cc: Likewise. * ptree.cc: Likewise. * rtti.cc: Likewise. * search.cc: Likewise. * semantics.cc: Likewise. * tree.cc: Likewise. * typeck.cc: Likewise. * typeck2.cc: Likewise. * vtable-class-hierarchy.cc: Likewise. gcc/d/ChangeLog: PR other/116613 * d-attribs.cc: Add #define INCLUDE_MEMORY. * d-builtins.cc: Likewise. * d-codegen.cc: Likewise. * d-convert.cc: Likewise. * d-diagnostic.cc: Likewise. * d-frontend.cc: Likewise. * d-lang.cc: Likewise. * d-longdouble.cc: Likewise. * d-target.cc: Likewise. * decl.cc: Likewise. * expr.cc: Likewise. * intrinsics.cc: Likewise. * modules.cc: Likewise. * toir.cc: Likewise. * typeinfo.cc: Likewise. * types.cc: Likewise. gcc/fortran/ChangeLog: PR other/116613 * arith.cc: Add #define INCLUDE_MEMORY. * array.cc: Likewise. * bbt.cc: Likewise. * check.cc: Likewise. * class.cc: Likewise. * constructor.cc: Likewise. * convert.cc: Likewise. * cpp.cc: Likewise. * data.cc: Likewise. * decl.cc: Likewise. * dependency.cc: Likewise. * dump-parse-tree.cc: Likewise. * error.cc: Likewise. * expr.cc: Likewise. * f95-lang.cc: Likewise. * frontend-passes.cc: Likewise. * interface.cc: Likewise. * intrinsic.cc: Likewise. * io.cc: Likewise. * iresolve.cc: Likewise. * match.cc: Likewise. * matchexp.cc: Likewise. * misc.cc: Likewise. * module.cc: Likewise. * openmp.cc: Likewise. * options.cc: Likewise. * parse.cc: Likewise. * primary.cc: Likewise. * resolve.cc: Likewise. * scanner.cc: Likewise. * simplify.cc: Likewise. * st.cc: Likewise. * symbol.cc: Likewise. * target-memory.cc: Likewise. * trans-array.cc: Likewise. * trans-common.cc: Likewise. * trans-const.cc: Likewise. * trans-decl.cc: Likewise. * trans-expr.cc: Likewise. * trans-intrinsic.cc: Likewise. * trans-io.cc: Likewise. * trans-openmp.cc: Likewise. * trans-stmt.cc: Likewise. * trans-types.cc: Likewise. * trans.cc: Likewise. gcc/go/ChangeLog: PR other/116613 * go-backend.cc: Add #define INCLUDE_MEMORY. * go-lang.cc: Likewise. gcc/jit/ChangeLog: PR other/116613 * dummy-frontend.cc: Add #define INCLUDE_MEMORY. * jit-playback.cc: Likewise. * jit-recording.cc: Likewise. gcc/lto/ChangeLog: PR other/116613 * lto-common.cc: Add #define INCLUDE_MEMORY. * lto-dump.cc: Likewise. * lto-partition.cc: Likewise. * lto-symtab.cc: Likewise. * lto.cc: Likewise. gcc/m2/ChangeLog: PR other/116613 * gm2-gcc/gcc-consolidation.h: Add #define INCLUDE_MEMORY. * gm2-gcc/m2configure.cc: Likewise. * mc-boot/GASCII.cc: Regenerate. * mc-boot/GASCII.h: Ditto. * mc-boot/GArgs.cc: Ditto. * mc-boot/GArgs.h: Ditto. * mc-boot/GAssertion.cc: Ditto. * mc-boot/GAssertion.h: Ditto. * mc-boot/GBreak.cc: Ditto. * mc-boot/GBreak.h: Ditto. * mc-boot/GCOROUTINES.h: Ditto. * mc-boot/GCmdArgs.cc: Ditto. * mc-boot/GCmdArgs.h: Ditto. * mc-boot/GDebug.cc: Ditto. * mc-boot/GDebug.h: Ditto. * mc-boot/GDynamicStrings.cc: Ditto. * mc-boot/GDynamicStrings.h: Ditto. * mc-boot/GEnvironment.cc: Ditto. * mc-boot/GEnvironment.h: Ditto. * mc-boot/GFIO.cc: Ditto. * mc-boot/GFIO.h: Ditto. * mc-boot/GFormatStrings.cc: Ditto. * mc-boot/GFormatStrings.h: Ditto. * mc-boot/GFpuIO.cc: Ditto. * mc-boot/GFpuIO.h: Ditto. * mc-boot/GIO.cc: Ditto. * mc-boot/GIO.h: Ditto. * mc-boot/GIndexing.cc: Ditto. * mc-boot/GIndexing.h: Ditto. * mc-boot/GM2Dependent.cc: Ditto. * mc-boot/GM2Dependent.h: Ditto. * mc-boot/GM2EXCEPTION.cc: Ditto. * mc-boot/GM2EXCEPTION.h: Ditto. * mc-boot/GM2RTS.cc: Ditto. * mc-boot/GM2RTS.h: Ditto. * mc-boot/GMemUtils.cc: Ditto. * mc-boot/GMemUtils.h: Ditto. * mc-boot/GNumberIO.cc: Ditto. * mc-boot/GNumberIO.h: Ditto. * mc-boot/GPushBackInput.cc: Ditto. * mc-boot/GPushBackInput.h: Ditto. * mc-boot/GRTExceptions.cc: Ditto. * mc-boot/GRTExceptions.h: Ditto. * mc-boot/GRTco.h: Ditto. * mc-boot/GRTentity.h: Ditto. * mc-boot/GRTint.cc: Ditto. * mc-boot/GRTint.h: Ditto. * mc-boot/GSArgs.cc: Ditto. * mc-boot/GSArgs.h: Ditto. * mc-boot/GSFIO.cc: Ditto. * mc-boot/GSFIO.h: Ditto. * mc-boot/GSYSTEM.h: Ditto. * mc-boot/GSelective.h: Ditto. * mc-boot/GStdIO.cc: Ditto. * mc-boot/GStdIO.h: Ditto. * mc-boot/GStorage.cc: Ditto. * mc-boot/GStorage.h: Ditto. * mc-boot/GStrCase.cc: Ditto. * mc-boot/GStrCase.h: Ditto. * mc-boot/GStrIO.cc: Ditto. * mc-boot/GStrIO.h: Ditto. * mc-boot/GStrLib.cc: Ditto. * mc-boot/GStrLib.h: Ditto. * mc-boot/GStringConvert.cc: Ditto. * mc-boot/GStringConvert.h: Ditto. * mc-boot/GSysExceptions.h: Ditto. * mc-boot/GSysStorage.cc: Ditto. * mc-boot/GSysStorage.h: Ditto. * mc-boot/GTimeString.cc: Ditto. * mc-boot/GTimeString.h: Ditto. * mc-boot/GUnixArgs.h: Ditto. * mc-boot/Galists.cc: Ditto. * mc-boot/Galists.h: Ditto. * mc-boot/Gdecl.cc: Ditto. * mc-boot/Gdecl.h: Ditto. * mc-boot/Gdtoa.h: Ditto. * mc-boot/Gerrno.h: Ditto. * mc-boot/Gkeyc.cc: Ditto. * mc-boot/Gkeyc.h: Ditto. * mc-boot/Gldtoa.h: Ditto. * mc-boot/Glibc.h: Ditto. * mc-boot/Glibm.h: Ditto. * mc-boot/Glists.cc: Ditto. * mc-boot/Glists.h: Ditto. * mc-boot/GmcComment.cc: Ditto. * mc-boot/GmcComment.h: Ditto. * mc-boot/GmcComp.cc: Ditto. * mc-boot/GmcComp.h: Ditto. * mc-boot/GmcDebug.cc: Ditto. * mc-boot/GmcDebug.h: Ditto. * mc-boot/GmcError.cc: Ditto. * mc-boot/GmcError.h: Ditto. * mc-boot/GmcFileName.cc: Ditto. * mc-boot/GmcFileName.h: Ditto. * mc-boot/GmcLexBuf.cc: Ditto. * mc-boot/GmcLexBuf.h: Ditto. * mc-boot/GmcMetaError.cc: Ditto. * mc-boot/GmcMetaError.h: Ditto. * mc-boot/GmcOptions.cc: Ditto. * mc-boot/GmcOptions.h: Ditto. * mc-boot/GmcPreprocess.cc: Ditto. * mc-boot/GmcPreprocess.h: Ditto. * mc-boot/GmcPretty.cc: Ditto. * mc-boot/GmcPretty.h: Ditto. * mc-boot/GmcPrintf.cc: Ditto. * mc-boot/GmcPrintf.h: Ditto. * mc-boot/GmcQuiet.cc: Ditto. * mc-boot/GmcQuiet.h: Ditto. * mc-boot/GmcReserved.cc: Ditto. * mc-boot/GmcReserved.h: Ditto. * mc-boot/GmcSearch.cc: Ditto. * mc-boot/GmcSearch.h: Ditto. * mc-boot/GmcStack.cc: Ditto. * mc-boot/GmcStack.h: Ditto. * mc-boot/GmcStream.cc: Ditto. * mc-boot/GmcStream.h: Ditto. * mc-boot/Gmcflex.h: Ditto. * mc-boot/Gmcp1.cc: Ditto. * mc-boot/Gmcp1.h: Ditto. * mc-boot/Gmcp2.cc: Ditto. * mc-boot/Gmcp2.h: Ditto. * mc-boot/Gmcp3.cc: Ditto. * mc-boot/Gmcp3.h: Ditto. * mc-boot/Gmcp4.cc: Ditto. * mc-boot/Gmcp4.h: Ditto. * mc-boot/Gmcp5.cc: Ditto. * mc-boot/Gmcp5.h: Ditto. * mc-boot/GnameKey.cc: Ditto. * mc-boot/GnameKey.h: Ditto. * mc-boot/GsymbolKey.cc: Ditto. * mc-boot/GsymbolKey.h: Ditto. * mc-boot/Gtermios.h: Ditto. * mc-boot/Gtop.cc: Ditto. * mc-boot/Gvarargs.cc: Ditto. * mc-boot/Gvarargs.h: Ditto. * mc-boot/Gwlists.cc: Ditto. * mc-boot/Gwlists.h: Ditto. * mc-boot/Gwrapc.h: Ditto. * mc/keyc.mod (checkGccConfigSystem): Add #define INCLUDE_MEMORY. * pge-boot/GASCII.cc: Regenerate. * pge-boot/GASCII.h: Ditto. * pge-boot/GArgs.cc: Ditto. * pge-boot/GArgs.h: Ditto. * pge-boot/GAssertion.cc: Ditto. * pge-boot/GAssertion.h: Ditto. * pge-boot/GBreak.h: Ditto. * pge-boot/GCmdArgs.h: Ditto. * pge-boot/GDebug.cc: Ditto. * pge-boot/GDebug.h: Ditto. * pge-boot/GDynamicStrings.cc: Ditto. * pge-boot/GDynamicStrings.h: Ditto. * pge-boot/GEnvironment.h: Ditto. * pge-boot/GFIO.cc: Ditto. * pge-boot/GFIO.h: Ditto. * pge-boot/GFormatStrings.h: Ditto. * pge-boot/GFpuIO.h: Ditto. * pge-boot/GIO.cc: Ditto. * pge-boot/GIO.h: Ditto. * pge-boot/GIndexing.cc: Ditto. * pge-boot/GIndexing.h: Ditto. * pge-boot/GLists.cc: Ditto. * pge-boot/GLists.h: Ditto. * pge-boot/GM2Dependent.cc: Ditto. * pge-boot/GM2Dependent.h: Ditto. * pge-boot/GM2EXCEPTION.cc: Ditto. * pge-boot/GM2EXCEPTION.h: Ditto. * pge-boot/GM2RTS.cc: Ditto. * pge-boot/GM2RTS.h: Ditto. * pge-boot/GNameKey.cc: Ditto. * pge-boot/GNameKey.h: Ditto. * pge-boot/GNumberIO.cc: Ditto. * pge-boot/GNumberIO.h: Ditto. * pge-boot/GOutput.cc: Ditto. * pge-boot/GOutput.h: Ditto. * pge-boot/GPushBackInput.cc: Ditto. * pge-boot/GPushBackInput.h: Ditto. * pge-boot/GRTExceptions.cc: Ditto. * pge-boot/GRTExceptions.h: Ditto. * pge-boot/GSArgs.h: Ditto. * pge-boot/GSEnvironment.h: Ditto. * pge-boot/GSFIO.cc: Ditto. * pge-boot/GSFIO.h: Ditto. * pge-boot/GSYSTEM.h: Ditto. * pge-boot/GScan.h: Ditto. * pge-boot/GStdIO.cc: Ditto. * pge-boot/GStdIO.h: Ditto. * pge-boot/GStorage.cc: Ditto. * pge-boot/GStorage.h: Ditto. * pge-boot/GStrCase.cc: Ditto. * pge-boot/GStrCase.h: Ditto. * pge-boot/GStrIO.cc: Ditto. * pge-boot/GStrIO.h: Ditto. * pge-boot/GStrLib.cc: Ditto. * pge-boot/GStrLib.h: Ditto. * pge-boot/GStringConvert.h: Ditto. * pge-boot/GSymbolKey.cc: Ditto. * pge-boot/GSymbolKey.h: Ditto. * pge-boot/GSysExceptions.h: Ditto. * pge-boot/GSysStorage.cc: Ditto. * pge-boot/GSysStorage.h: Ditto. * pge-boot/GTimeString.h: Ditto. * pge-boot/GUnixArgs.h: Ditto. * pge-boot/Gbnflex.cc: Ditto. * pge-boot/Gbnflex.h: Ditto. * pge-boot/Gdtoa.h: Ditto. * pge-boot/Gerrno.h: Ditto. * pge-boot/Gldtoa.h: Ditto. * pge-boot/Glibc.h: Ditto. * pge-boot/Glibm.h: Ditto. * pge-boot/Gpge.cc: Ditto. * pge-boot/Gtermios.h: Ditto. * pge-boot/Gwrapc.h: Ditto. gcc/objc/ChangeLog: PR other/116613 * objc-act.cc: Add #define INCLUDE_MEMORY. * objc-encoding.cc: Likewise. * objc-gnu-runtime-abi-01.cc: Likewise. * objc-lang.cc: Likewise. * objc-next-runtime-abi-01.cc: Likewise. * objc-next-runtime-abi-02.cc: Likewise. * objc-runtime-shared-support.cc: Likewise. gcc/objcp/ChangeLog:: Add #define INCLUDE_MEMORY. PR other/116613 * objcp-decl.cc * objcp-lang.cc: Likewise. gcc/rust/ChangeLog: PR other/116613 * resolve/rust-ast-resolve-expr.cc: Add #define INCLUDE_MEMORY. * rust-attribs.cc: Likewise. * rust-system.h: Likewise. gcc/ChangeLog: PR other/116613 * asan.cc: Add #define INCLUDE_MEMORY. * attribs.cc: Likewise. (attr_access::array_as_string): Use diagnostic_context::clone_printer and use unique_ptr. * auto-profile.cc: Add #define INCLUDE_MEMORY. * calls.cc: Likewise. * cfganal.cc: Likewise. * cfgexpand.cc: Likewise. * cfghooks.cc: Likewise. * cfgloop.cc: Likewise. * cgraph.cc: Likewise. * cgraphclones.cc: Likewise. * cgraphunit.cc: Likewise. * collect-utils.cc: Likewise. * collect2.cc: Likewise. * common/config/aarch64/aarch64-common.cc: Likewise. * common/config/arm/arm-common.cc: Likewise. * common/config/avr/avr-common.cc: Likewise. * config/aarch64/aarch64-cc-fusion.cc: Likewise. * config/aarch64/aarch64-early-ra.cc: Likewise. * config/aarch64/aarch64-sve-builtins.cc: Likewise. * config/arc/arc.cc: Likewise. * config/arm/aarch-common.cc: Likewise. * config/arm/arm-mve-builtins.cc: Likewise. * config/avr/avr-devices.cc: Likewise. * config/avr/driver-avr.cc: Likewise. * config/bpf/bpf.cc: Likewise. * config/bpf/btfext-out.cc: Likewise. * config/bpf/core-builtins.cc: Likewise. * config/darwin.cc: Likewise. * config/i386/driver-i386.cc: Likewise. * config/i386/i386-builtins.cc: Likewise. * config/i386/i386-expand.cc: Likewise. * config/i386/i386-features.cc: Likewise. * config/i386/i386-options.cc: Likewise. * config/loongarch/loongarch-builtins.cc: Likewise. * config/mingw/winnt-cxx.cc: Likewise. * config/mingw/winnt.cc: Likewise. * config/mips/mips.cc: Likewise. * config/msp430/driver-msp430.cc: Likewise. * config/nvptx/mkoffload.cc: Likewise. * config/nvptx/nvptx.cc: Likewise. * config/riscv/riscv-avlprop.cc: Likewise. * config/riscv/riscv-vector-builtins.cc: Likewise. * config/riscv/riscv-vsetvl.cc: Likewise. * config/rs6000/driver-rs6000.cc: Likewise. * config/rs6000/host-darwin.cc: Likewise. * config/rs6000/rs6000-c.cc: Likewise. * config/s390/s390-c.cc: Likewise. * config/s390/s390.cc: Likewise. * config/sol2-cxx.cc: Likewise. * config/vms/vms-c.cc: Likewise. * config/xtensa/xtensa-dynconfig.cc: Likewise. * coroutine-passes.cc: Likewise. * coverage.cc: Likewise. * data-streamer-in.cc: Likewise. * data-streamer-out.cc: Likewise. * data-streamer.cc: Likewise. * diagnostic-buffer.h (diagnostic_buffer::~diagnostic_buffer): Delete. (diagnostic_buffer::m_per_format_buffer): Use std::unique_ptr. * diagnostic-client-data-hooks.h (make_compiler_data_hooks): Use std::unique_ptr for return type. * diagnostic-format-json.cc (json_output_format::make_per_format_buffer): Likewise. (diagnostic_output_format_init_json): Update for usage of std::unique_ptr in set_output_format. * diagnostic-format-sarif.cc (sarif_output_format::make_per_format_buffer): Use std::unique_ptr for return type. (diagnostic_output_format_init_sarif): Update for usage of std::unique_ptr. (test_message_with_embedded_link): Likewise for set_urlifier. * diagnostic-format-text.cc: Add #define INCLUDE_MEMORY. Include "make-unique.h". (diagnostic_text_output_format::set_buffer): Use std::unique_ptr. * diagnostic-format-text.h (diagnostic_text_output_format::set_buffer): Likewise. * diagnostic-format.h (diagnostic_output_format::make_per_format_buffer): Likewise. * diagnostic-global-context.cc: * diagnostic-macro-unwinding.cc: Likewise. * diagnostic-show-locus.cc: Likewise. * diagnostic-spec.cc: Likewise. * diagnostic.cc (diagnostic_context::set_output_format): Use std::unique_ptr for input. (diagnostic_context::set_client_data_hooks): Likewise. (diagnostic_context::set_option_manager): Likewise. (diagnostic_context::set_urlifier): Likewise. (diagnostic_context::set_diagnostic_buffer): Update for use of std::unique_ptr. (diagnostic_buffer::diagnostic_buffer): Likewise. (diagnostic_buffer::~diagnostic_buffer): Delete. * diagnostic.h: Complain if INCLUDE_MEMORY was not defined. (diagnostic_context::set_output_format): Use std::unique_ptr for input. (diagnostic_context::set_client_data_hooks): Likewise. (diagnostic_context::set_option_manager): Likewise. (diagnostic_context::set_urlifier): Likewise. (diagnostic_context::clone_printer): New. (diagnostic_context::m_printer): Update comment. (diagnostic_context::m_option_mgr): Likewise. (diagnostic_context::m_urlifier): Likewise. (diagnostic_context::m_edit_context_ptr): Likewise. (diagnostic_context::m_output_format): Likewise. (diagnostic_context::m_client_data_hooks): Likewise. (diagnostic_context::m_theme): Likewise. * digraph.cc: Add #define INCLUDE_MEMORY. * dwarf2out.cc: Likewise. * edit-context.cc: Likewise. * except.cc: Likewise. * expr.cc: Likewise. * file-prefix-map.cc: Likewise. * final.cc: Likewise. * fwprop.cc: Likewise. * gcc-plugin.h: Likewise. * gcc-rich-location.cc: Likewise. * gcc-urlifier.cc: Likewise. Add #include "make-unique.h". (make_gcc_urlifier): Use std::unique_ptr and ::make_unique. * gcc-urlifier.h (make_gcc_urlifier): Use std::unique_ptr. * gcc.cc: Add #define INCLUDE_MEMORY. Include "pretty-print-urlifier.h". * gcov-dump.cc: Add #define INCLUDE_MEMORY. * gcov-tool.cc: Likewise. * gengtype.cc (open_base_files): Likewise to output. * genmatch.cc: Likewise. * gimple-fold.cc: Likewise. * gimple-harden-conditionals.cc: Likewise. * gimple-harden-control-flow.cc: Likewise. * gimple-if-to-switch.cc: Likewise. * gimple-lower-bitint.cc: Likewise. * gimple-predicate-analysis.cc: Likewise. * gimple-pretty-print.cc: Likewise. * gimple-range-cache.cc: Likewise. * gimple-range-edge.cc: Likewise. * gimple-range-fold.cc: Likewise. * gimple-range-gori.cc: Likewise. * gimple-range-infer.cc: Likewise. * gimple-range-op.cc: Likewise. * gimple-range-path.cc: Likewise. * gimple-range-phi.cc: Likewise. * gimple-range-trace.cc: Likewise. * gimple-range.cc: Likewise. * gimple-ssa-backprop.cc: Likewise. * gimple-ssa-sprintf.cc: Likewise. * gimple-ssa-store-merging.cc: Likewise. * gimple-ssa-strength-reduction.cc: Likewise. * gimple-ssa-warn-access.cc: Likewise. * gimple-ssa-warn-alloca.cc: Likewise. * gimple-ssa-warn-restrict.cc: Likewise. * gimple-streamer-in.cc: Likewise. * gimple-streamer-out.cc: Likewise. * gimple.cc: Likewise. * gimplify.cc: Likewise. * graph.cc: Likewise. * graphviz.cc: Likewise. * input.cc: Likewise. * ipa-cp.cc: Likewise. * ipa-devirt.cc: Likewise. * ipa-fnsummary.cc: Likewise. * ipa-free-lang-data.cc: Likewise. * ipa-icf-gimple.cc: Likewise. * ipa-icf.cc: Likewise. * ipa-inline-analysis.cc: Likewise. * ipa-inline.cc: Likewise. * ipa-modref-tree.cc: Likewise. * ipa-modref.cc: Likewise. * ipa-param-manipulation.cc: Likewise. * ipa-polymorphic-call.cc: Likewise. * ipa-predicate.cc: Likewise. * ipa-profile.cc: Likewise. * ipa-prop.cc: Likewise. * ipa-pure-const.cc: Likewise. * ipa-reference.cc: Likewise. * ipa-split.cc: Likewise. * ipa-sra.cc: Likewise. * ipa-strub.cc: Likewise. * ipa-utils.cc: Likewise. * langhooks.cc: Likewise. * late-combine.cc: Likewise. * lto-cgraph.cc: Likewise. * lto-compress.cc: Likewise. * lto-opts.cc: Likewise. * lto-section-in.cc: Likewise. * lto-section-out.cc: Likewise. * lto-streamer-in.cc: Likewise. * lto-streamer-out.cc: Likewise. * lto-streamer.cc: Likewise. * lto-wrapper.cc: Likewise. Include "make-unique.h". (main): Use ::make_unique when creating option manager. * multiple_target.cc: Likewise. * omp-expand.cc: Likewise. * omp-general.cc: Likewise. * omp-low.cc: Likewise. * omp-oacc-neuter-broadcast.cc: Likewise. * omp-offload.cc: Likewise. * omp-simd-clone.cc: Likewise. * optc-gen.awk: Likewise in output. * optc-save-gen.awk: Likewise in output. * options-urls-cc-gen.awk: Likewise in output. * opts-common.cc: Likewise. * opts-global.cc: Likewise. * opts.cc: Likewise. * pair-fusion.cc: Likewise. * passes.cc: Likewise. * pointer-query.cc: Likewise. * predict.cc: Likewise. * pretty-print.cc (pretty_printer::clone): Use std::unique_ptr and ::make_unique. * pretty-print.h: Complain if INCLUDE_MEMORY is not defined. (pretty_printer::clone): Use std::unique_ptr. * print-rtl.cc: Add #define INCLUDE_MEMORY. * print-tree.cc: Likewise. * profile-count.cc: Likewise. * range-op-float.cc: Likewise. * range-op-ptr.cc: Likewise. * range-op.cc: Likewise. * range.cc: Likewise. * read-rtl-function.cc: Likewise. * rtl-error.cc: Likewise. * rtl-ssa/accesses.cc: Likewise. * rtl-ssa/blocks.cc: Likewise. * rtl-ssa/changes.cc: Likewise. * rtl-ssa/functions.cc: Likewise. * rtl-ssa/insns.cc: Likewise. * rtl-ssa/movement.cc: Likewise. * rtl-tests.cc: Likewise. * sanopt.cc: Likewise. * sched-rgn.cc: Likewise. * selftest-diagnostic-path.cc: Likewise. * selftest-diagnostic.cc: Likewise. * splay-tree-utils.cc: Likewise. * sreal.cc: Likewise. * stmt.cc: Likewise. * substring-locations.cc: Likewise. * symtab-clones.cc: Likewise. * symtab-thunks.cc: Likewise. * symtab.cc: Likewise. * text-art/box-drawing.cc: Likewise. * text-art/canvas.cc: Likewise. * text-art/ruler.cc: Likewise. * text-art/selftests.cc: Likewise. * text-art/theme.cc: Likewise. * toplev.cc: Likewise. Include "make-unique.h". (general_init): Use ::make_unique when setting option_manager. * trans-mem.cc: Add #define INCLUDE_MEMORY. * tree-affine.cc: Likewise. * tree-call-cdce.cc: Likewise. * tree-cfg.cc: Likewise. * tree-chrec.cc: Likewise. * tree-dfa.cc: Likewise. * tree-diagnostic-client-data-hooks.cc: Include "make-unique.h". (make_compiler_data_hooks): Use std::unique_ptr and ::make_unique. * tree-diagnostic.cc: Add #define INCLUDE_MEMORY. * tree-dump.cc: Likewise. * tree-inline.cc: Likewise. * tree-into-ssa.cc: Likewise. * tree-logical-location.cc: Likewise. * tree-nested.cc: Likewise. * tree-nrv.cc: Likewise. * tree-object-size.cc: Likewise. * tree-outof-ssa.cc: Likewise. * tree-pretty-print.cc: Likewise. * tree-profile.cc: Likewise. * tree-scalar-evolution.cc: Likewise. * tree-sra.cc: Likewise. * tree-ssa-address.cc: Likewise. * tree-ssa-alias.cc: Likewise. * tree-ssa-ccp.cc: Likewise. * tree-ssa-coalesce.cc: Likewise. * tree-ssa-copy.cc: Likewise. * tree-ssa-dce.cc: Likewise. * tree-ssa-dom.cc: Likewise. * tree-ssa-forwprop.cc: Likewise. * tree-ssa-ifcombine.cc: Likewise. * tree-ssa-loop-ch.cc: Likewise. * tree-ssa-loop-im.cc: Likewise. * tree-ssa-loop-manip.cc: Likewise. * tree-ssa-loop-niter.cc: Likewise. * tree-ssa-loop-split.cc: Likewise. * tree-ssa-math-opts.cc: Likewise. * tree-ssa-operands.cc: Likewise. * tree-ssa-phiprop.cc: Likewise. * tree-ssa-pre.cc: Likewise. * tree-ssa-propagate.cc: Likewise. * tree-ssa-reassoc.cc: Likewise. * tree-ssa-sccvn.cc: Likewise. * tree-ssa-scopedtables.cc: Likewise. * tree-ssa-sink.cc: Likewise. * tree-ssa-strlen.cc: Likewise. * tree-ssa-structalias.cc: Likewise. * tree-ssa-ter.cc: Likewise. * tree-ssa-uninit.cc: Likewise. * tree-ssa.cc: Likewise. * tree-ssanames.cc: Likewise. * tree-stdarg.cc: Likewise. * tree-streamer-in.cc: Likewise. * tree-streamer-out.cc: Likewise. * tree-streamer.cc: Likewise. * tree-switch-conversion.cc: Likewise. * tree-tailcall.cc: Likewise. * tree-vrp.cc: Likewise. * tree.cc: Likewise. * ubsan.cc: Likewise. * value-pointer-equiv.cc: Likewise. * value-prof.cc: Likewise. * value-query.cc: Likewise. * value-range-pretty-print.cc: Likewise. * value-range-storage.cc: Likewise. * value-range.cc: Likewise. * value-relation.cc: Likewise. * var-tracking.cc: Likewise. * varpool.cc: Likewise. * vr-values.cc: Likewise. * wide-int-print.cc: Likewise. gcc/testsuite/ChangeLog: PR other/116613 * gcc.dg/plugin/diagnostic_group_plugin.c: Update for use of std::unique_ptr. * gcc.dg/plugin/diagnostic_plugin_xhtml_format.c: Likewise. * gcc.dg/plugin/ggcplug.c: Likewise. libgcc/ChangeLog: PR other/116613 * libgcov-util.c: Add #define INCLUDE_MEMORY. Signed-off-by: David Malcolm <dmalcolm@redhat.com> Co-authored-by: Gaius Mulley <gaiusmod2@gmail.com> Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2024-09-16PR modula2/116181 Use GCC tree location_t and separate pointer typesGaius Mulley20-409/+465
This patch fixes all remaining -Wodr warnings in the modula-2 front end. It removes the m2 Tree and m2 Location definitions and uses tree and location_t throughout. This allows the bootstrap tool mc to pick up the GCC definitions for these data types (for the C translation of m2 sources). The patch introduces a new module CDataTypes which contain two pointer types: CharStar and ConstCharStar. These map onto their C counterparts when processed by mc however currently gm2 treats them as ADDRESS. It might be sensible to have the gm2 versions of these data types implemented though a builtin module in the future. gcc/m2/ChangeLog: PR modula2/116181 * Make-lang.in (GM2-GCC-DEFS): Add gcctypes.def and CDataTypes.def. (MC-LIB-DEFS): Add CDataTypes.def. * Make-maintainer.in (m2/gm2-pge-boot/$(SRC_PREFIX)M2RTS.o): Change include path to pge-boot. (m2/gm2-pge-boot/$(SRC_PREFIX)SymbolKey.o): Ditto. (m2/gm2-pge-boot/$(SRC_PREFIX)NameKey.o): Ditto. (m2/gm2-pge-boot/$(SRC_PREFIX)Lists.o): Ditto. (m2/gm2-pge-boot/$(SRC_PREFIX)Output.o): Ditto. (m2/gm2-pge-boot/$(SRC_PREFIX)bnflex.o): Ditto. (m2/gm2-pge-boot/$(SRC_PREFIX)RTentity.h): Ditto. (m2/gm2-pge-boot/$(SRC_PREFIX)RTentity.o): Ditto. (m2/gm2-pge-boot/$(SRC_PREFIX)%.o): Ditto. (GM2PATH): Add -I$(srcdir)/m2/gm2-gcc. (m2/mc-boot-gen/$(SRC_PREFIX)%.h): Add -I$(srcdir)/m2/gm2-gcc. (m2/mc-boot-gen/$(SRC_PREFIX)%.cc): Ditto. * gm2-compiler/M2ALU.def (PushIntegerTree): Replace Tree with tree. (PopIntegerTree): Ditto. (PushRealTree): Ditto. (PopRealTree): Ditto. (PushComplexTree): Ditto. (PopComplexTree): Ditto. (PushSetTree): Ditto. (PopSetTree): Ditto. (PopConstructorTree): Ditto. (ConstructSetConstant): Ditto. (BuildRange): Ditto. (CheckOrResetOverflow): Ditto. (PushTypeOfTree): Ditto. * gm2-compiler/M2ALU.mod (Tree): Replace with ... (tree): ... this. (gcctypes): Import location_t and tree. (m2linemap): Remove import of location_t. * gm2-compiler/M2Base.def (m2linemap): Replace with ... (gcctypes): ... this. * gm2-compiler/M2Base.mod (gcctypes): Import of location_t. (m2linemap): Remove import of location_t. * gm2-compiler/M2Bitset.mod (m2tree): Remove import of Tree. * gm2-compiler/M2CaseList.mod (gcctypes): Import tree. (m2tree): Remove import of Tree. (Tree): Replace with ... (tree): ... this. * gm2-compiler/M2Emit.def (gcctypes): Import location_t. * gm2-compiler/M2GCCDeclare.def (gcctypes): Import tree. (PromoteToString): Replace Tree with tree. (PromoteToCString): Ditto. (ConstantKnownAndUsed): Ditto. * gm2-compiler/M2GCCDeclare.mod (gcctypes): Import tree. (m2tree): Remove import of Tree. (Tree): Replace with ... (tree): ... this. * gm2-compiler/M2GenGCC.def (gcctypes): Import tree. (m2tree): Remove import of Tree. (Tree): Replace with ... (tree): ... this. (GetHighFromUnbounded): Replace Tree with tree. (StringToChar): Ditto. (LValueToGenericPtr): Ditto. (ZConstToTypedConst): Ditto. (PrepareCopyString): Ditto. * gm2-compiler/M2GenGCC.mod (gcctypes): Import tree. (m2tree): Remove import of Tree. (Tree): Replace with ... (tree): ... this. * gm2-compiler/M2LangDump.def (gcctypes): Import tree. (m2tree): Remove import of Tree. (Tree): Replace with ... (tree): ... this. * gm2-compiler/M2LangDump.mod (Tree): Replace with ... (tree): ... this. * gm2-compiler/M2LexBuf.def (m2linemap): Replace with ... (gcctypes): ... this. * gm2-compiler/M2LexBuf.mod (m2linemap): Replace with ... (gcctypes): ... this. * gm2-compiler/M2Options.def (m2linemap): Replace with ... (gcctypes): ... this. * gm2-compiler/M2Options.mod (m2linemap): Replace with ... (gcctypes): ... this. * gm2-compiler/M2Range.def (m2linemap): Replace with ... (gcctypes): ... this. (CDataTypes): Import ConstCharStar. (CodeErrorCheck): Replace Tree with tree. (OverlapsRange): Ditto. (IsEqual): Ditto. (IsGreaterOrEqual): Ditto. (IsGreater): Ditto. (BuildIfCallWholeHandlerLoc): Replace Tree with tree. Replace ADDRESS with ConstCharStar. (BuildIfCallRealHandlerLoc): Ditto. (GetMinMax): Ditto. * gm2-compiler/M2Range.mod (m2tree): Remove Tree. (CodeErrorCheck): Replace Tree with tree. (OverlapsRange): Ditto. (IsEqual): Ditto. (IsGreaterOrEqual): Ditto. (IsGreater): Ditto. (GetMinMax): Ditto. (BuildIfCallWholeHandlerLoc): Replace Tree with tree. Replace ADDRESS with ConstCharStar. (BuildIfCallRealHandlerLoc): Ditto. * gm2-compiler/M2System.def (m2linemap): Replace with ... (gcctypes): ... this. * gm2-compiler/M2System.mod (m2linemap): Replace with ... (gcctypes): ... this. (CreateMinMaxFor): Replace Tree with tree. (CreateType): Ditto. (AttemptToCreateType): Ditto. (CreateSetType): Ditto. (AttemptToCreateSetType): Ditto. * gm2-compiler/P2SymBuild.mod (m2linemap): Replace with ... (gcctypes): ... this. * gm2-compiler/SymbolConversion.def (m2tree): Replace with ... (gcctypes): ... this. (Mod2Gcc): Replace Tree with tree. (Gcc2Mod): Ditto. (AddModGcc): Ditto. * gm2-compiler/SymbolConversion.mod (m2tree): Replace with ... (gcctypes): ... this. (Mod2Gcc): Replace Tree with tree. (Gcc2Mod): Ditto. (AddModGcc): Ditto. (Mod2GccWithoutGCCPoison): Ditto. * gm2-compiler/SymbolTable.def (m2tree): Replace with ... (gcctypes): ... this. (PutModuleFinallyFunction): Replace Tree with tree. (GetModuleFinallyFunction): Ditto. * gm2-compiler/SymbolTable.mod (m2tree): Replace with ... (gcctypes): ... this. (PutModuleFinallyFunction): Replace Tree with tree. (GetModuleFinallyFunction): Ditto. * gm2-compiler/m2flex.def (m2linemap): Replace with ... (gcctypes): ... this. * gm2-gcc/init.def (PerCompilationInit): Replace ADDRESS with ConstCharStar. (CDataTypes): Import ConstCharStar. * gm2-gcc/m2block.def (SYSTEM): Remove import. (CDataTypes): Import ConstCharStar. (m2linemap): Remove import. (m2tree): Remove import. (gcctypes): Import tree. (global_constant): Replace Tree with tree. (RememberInitModuleFunction): Ditto. (DumpGlobalConstants): Ditto. (RememberConstant): Ditto. (RememberType): Ditto. (pushDecl): Ditto. (popFunctionScope): Ditto. (pushFunctionScope): Ditto. (finishFunctionCode): Ditto. (finishFunctionDecl): Ditto. (GetErrorNode): Ditto. (includeDecl): Ditto. (GetGlobals): Ditto. (GetGlobalContext): Ditto. (begin_statement_list): Ditto. (push_statement_list): Ditto. (pop_statement_list): Ditto. (getLabel): Replace Tree with tree. Replace ADDRESS with ConstCharStar. * gm2-gcc/m2builtins.def (CDataTypes): Import ConstCharStar. (GetBuiltinConst): Replace Tree with tree. (GetBuiltinConstType): Ditto. (GetBuiltinTypeInfoType): Ditto. (GetBuiltinTypeInfo): Ditto. (BuiltinExists): Ditto. (BuildBuiltinTree): Ditto. (BuiltinMemCopy): Ditto. (BuiltinMemSet): Ditto. (BuiltInAlloca): Ditto. (BuiltInIsfinite): Ditto. * gm2-gcc/m2convert.def (CDataTypes): Import ConstCharStar. (ToWord): Ditto. (ToCardinal): Ditto. (ToInteger): Ditto. (ToBitset): Ditto. (ConvertToPtr): Ditto. (BuildConvert): Ditto. (ConvertConstantAndCheck): Ditto. (ConvertString): Ditto. (GenericToType): Ditto. * gm2-gcc/m2decl.cc (m2decl_BuildParameterDeclaration): Add const attribute. * gm2-gcc/m2decl.def (CDataTypes): Import ConstCharStar. (BuildModuleCtor): Ditto. (DeclareModuleCtor): Ditto. (DeclareM2linkForcedModuleInitOrder): Ditto. (DeclareM2linkStaticInitialization): Ditto. (BuildPtrToTypeString): Ditto. (BuildIntegerConstant): Ditto. (BuildStringConstantType): Ditto. (DeclareKnownVariable): Ditto. (DeclareKnownConstant): Ditto. (BuildParameterDeclaration): Ditto. (BuildEndFunctionDeclaration): Ditto. (RememberVariables): Ditto. (BuildConstLiteralNumber): Ditto. (BuildStringConstant): Ditto. (BuildCStringConstant): Ditto. (GetDeclContext): Ditto. * gm2-gcc/m2decl.h (m2decl_BuildParameterDeclaration): Add const attribute. * gm2-gcc/m2except.def (CDataTypes): Import ConstCharStar. (BuildThrow): Ditto. (BuildTryBegin): Ditto. (BuildTryEnd): Ditto. (BuildCatchBegin): Ditto. (BuildCatchEnd): Ditto. * gm2-gcc/m2expr.def (CDataTypes): Import ConstCharStar. (CSTIntToString): Ditto. (CSTIntToChar): Ditto. (CheckConstStrZtypeRange): Ditto. (CompareTrees): Ditto. (GetPointerOne): Ditto. (GetPointerZero): Ditto. (GetWordOne): Ditto. (GetWordZero): Ditto. (GetIntegerOne): Ditto. (GetIntegerZero): Ditto. (GetCardinalOne): Ditto. (GetCardinalZero): Ditto. (GetSizeOfInBits): Ditto. (GetSizeOf): Ditto. (BuildLogicalRotate): Ditto. (BuildLRRn): Ditto. (BuildLRLn): Ditto. (BuildMask): Ditto. (BuildMult): Ditto. (BuildMultCheck): Ditto. (BuildLRR): Ditto. (BuildLRL): Ditto. (BuildLogicalShift): Ditto. (BuildLSR): Ditto. (BuildLSL): Ditto. (BuildDivM2): Ditto. (BuildDivM2Check): Ditto. (BuildModM2): Ditto. (BuildModM2Check): Ditto. (BuildModFloor): Ditto. (BuildDivCeil): Ditto. (BuildModCeil): Ditto. (BuildDivFloor): Ditto. (BuildModTrunc): Ditto. (BuildDivTrunc): Ditto. (BuildDivTruncCheck): Ditto. (BuildRDiv): Ditto. (BuildSubCheck): Ditto. (BuildAddCheck): Ditto. (BuildSub): Ditto. (BuildAdd): Ditto. (FoldAndStrip): Ditto. (StringLength): Ditto. (TreeOverflow): Ditto. (RemoveOverflow): Ditto. (BuildCoerce): Ditto. (BuildTrunc): Ditto. (BuildNegate): Ditto. (BuildNegateCheck): Ditto. (BuildSetNegate): Ditto. (BuildTBitSize): Ditto. (BuildSize): Ditto. (BuildAddr): Ditto. (BuildOffset1): Ditto. (BuildOffset): Ditto. (BuildLogicalOrAddress): Ditto. (BuildLogicalOr): Ditto. (BuildLogicalAnd): Ditto. (BuildSymmetricDifference): Ditto. (BuildLogicalDifference): Ditto. (BuildLessThan): Ditto. (BuildGreaterThan): Ditto. (BuildLessThanOrEqual): Ditto. (BuildGreaterThanOrEqual): Ditto. (BuildEqualTo): Ditto. (BuildNotEqualTo): Ditto. (BuildIsSuperset): Ditto. (BuildIsNotSuperset): Ditto. (BuildIsSubset): Ditto. (BuildIsNotSubset): Ditto. (BuildIfConstInVar): Ditto. (BuildIfNotConstInVar): Ditto. (BuildIfVarInVar): Ditto. (BuildIfNotVarInVar): Ditto. (BuildForeachWordInSetDoIfExpr): Ditto. (BuildIfInRangeGoto): Ditto. (BuildIfNotInRangeGoto): Ditto. (BuildArray): Ditto. (BuildComponentRef): Ditto. (BuildIndirect): Ditto. (IsTrue): Ditto. (IsFalse): Ditto. (GetCstInteger): Ditto. (AreConstantsEqual): Ditto. (AreRealOrComplexConstantsEqual): Ditto. (DetermineSign): Ditto. (BuildCap): Ditto. (BuildAbs): Ditto. (BuildRe): Ditto. (BuildIm): Ditto. (BuildCmplx): Ditto. (BuildBinaryForeachWordDo): Ditto. (BuildBinarySetDo): Ditto. (ConstantExpressionWarning): Ditto. (BuildAddAddress): Ditto. (calcNbits): Ditto. (OverflowZType): Ditto. (BuildCondIfExpression): Ditto. * gm2-gcc/m2linemap.def (CDataTypes): Import ConstCharStar. * gm2-gcc/m2misc.def (m2tree): Replace with ... (gcctypes): ... this. (DebugTree): Replace Tree with tree. * gm2-gcc/m2pp.def (m2tree): Replace with ... (gcctypes): ... this. (DumpGimpleFd): Replace Tree with tree. * gm2-gcc/m2statement.cc (m2statement_BuildBuiltinCallTree): Remove unused location parameter. * gm2-gcc/m2statement.def (m2linemap): Replace with ... (gcctypes): ... this. (CDataTypes): Import CharStar. (DoJump): Replace Tree with tree. Replace ADDRESS with CharStar. (BuildStartFunctionCode): Replace Tree with tree. (BuildEndFunctionCode): Ditto. (BuildReturnValueCode): Ditto. (BuildAssignmentTree): Ditto. (BuildAssignmentStatement): Ditto. (BuildGoto): Ditto. (DeclareLabel): Ditto. (BuildIfThenDoEnd): Ditto. (BuildIfThenElseEnd): Ditto. (BuildParam): Ditto. (BuildFunctionCallTree): Ditto. (BuildProcedureCallTree): Ditto. (BuildIndirectProcedureCallTree): Ditto. (BuildFunctValue): Ditto. (BuildCall2): Ditto. (BuildCall3): Ditto. (SetLastFunction): Ditto. (GetLastFunction): Ditto. (GetParamTree): Ditto. (BuildTryFinally): Ditto. (BuildCleanUp): Ditto. (BuildAsm): Ditto. (BuildUnaryForeachWordDo): Ditto. (BuildExcludeVarConst): Ditto. (BuildExcludeVarVar): Ditto. (BuildIncludeVarConst): Ditto. (BuildIncludeVarVar): Ditto. (BuildStart): Ditto. (BuildEnd): Ditto. (BuildCallInner): Ditto. (BuildBuiltinCallTree): Remove unused location parameter. * gm2-gcc/m2statement.h (m2statement_BuildBuiltinCallTree): Remove unused location parameter. * gm2-gcc/m2tree.def (gcctypes): Import tree. (IsAConstant): Replace Tree with tree. (IsOrdinal): Ditto. (IsTreeOverflow): Ditto. (skip_const_decl): Ditto. (skip_type_decl): Ditto. (is_type): Ditto. (is_array): Ditto. (is_var): Ditto. (debug_tree): Ditto. (IstreeOverflow): Ditto. * gm2-gcc/m2treelib.def (m2linemap): Replace with ... (gcctypes): ... this. (get_set_address_if_var): Ditto. (get_set_field_rhs): Ditto. (get_set_field_lhs): Ditto. (get_set_address): Ditto. (get_set_value): Ditto. (get_field_no): Ditto. (get_rvalue): Ditto. (DoCall): Ditto. (build_modify_expr): Ditto. (do_jump_if_bit): Ditto. * gm2-gcc/m2type.def (m2linemap): Replace with ... (gcctypes): ... this. (m2tree): Remove. (CDataTypes): Import ConstCharStar and charStar. (ValueInTypeRange): Replace Tree with tree. (ValueOutOfTypeRange): Ditto. (ExceedsTypeRange): Ditto. (WithinTypeRange): Ditto. (BuildSubrangeType): Ditto. (BuildCharConstant): Ditto. (BuildCharConstantChar): Ditto. (BuildArrayConstructorElement): Ditto. (BuildEndArrayConstructor): Ditto. (BuildStartArrayConstructor): Ditto. (BuildRecordConstructorElement): Ditto. (BuildEndRecordConstructor): Ditto. (BuildStartRecordConstructor): Ditto. (BuildEndSetConstructor): Ditto. (BuildSetConstructorElement): Ditto. (BuildStartSetConstructor): Ditto. (BuildSetType): Ditto. (BuildConstPointerType): Ditto. (BuildPointerType): Ditto. (BuildEnumerator): Ditto. (BuildEndEnumeration): Ditto. (BuildStartEnumeration): Ditto. (BuildTypeDeclaration): Ditto. (GetMaxFrom): Ditto. (GetMinFrom): Ditto. (GetDefaultType): Ditto. (BuildEndType): Ditto. (BuildStartType): Ditto. (BuildVariableArrayAndDeclare): Ditto. (BuildProcTypeParameterDeclaration): Ditto. (BuildStartFunctionType): Ditto. (BuildEndFunctionType): Ditto. (GetTreeType): Ditto. (DeclareKnownType): Ditto. (GetM2ZType): Ditto. (GetM2RType): Ditto. (BuildSetTypeFromSubrange): Ditto. (BuildSmallestTypeRange): Ditto. (GetBooleanType): Ditto. (GetBooleanFalse): Ditto. (GetBooleanTrue): Ditto. (GetPackedBooleanType): Ditto. (GetCharType): Ditto. (GetByteType): Ditto. (GetVoidType): Ditto. (GetBitnumType): Ditto. (GetRealType): Ditto. (GetLongRealType): Ditto. (GetShortRealType): Ditto. (GetLongIntType): Ditto. (GetPointerType): Ditto. (GetCardinalType): Ditto. (GetIntegerType): Ditto. (GetWordType): Ditto. (GetM2CardinalType): Ditto. (GetBitsetType): Ditto. (GetM2CType): Ditto. (GetProcType): Ditto. (GetM2ComplexType): Ditto. (GetM2LongComplexType): Ditto. (GetM2ShortComplexType): Ditto. (GetM2Complex128): Ditto. (GetM2Complex96): Ditto. (GetM2Complex64): Ditto. (GetM2Complex32): Ditto. (GetM2Real128): Ditto. (GetM2Real96): Ditto. (GetM2Real64): Ditto. (GetM2Real32): Ditto. (GetM2Bitset32): Ditto. (GetM2Bitset16): Ditto. (GetM2Bitset8): Ditto. (GetM2Word64): Ditto. (GetM2Word32): Ditto. (GetM2Word16): Ditto. (GetM2Cardinal64): Ditto. (GetM2Cardinal32): Ditto. (GetM2Cardinal16): Ditto. (GetM2Cardinal8): Ditto. (GetM2Integer64): Ditto. (GetM2Integer32): Ditto. (GetM2Integer16): Ditto. (GetM2Integer8): Ditto. (GetISOLocType): Ditto. (GetISOByteType): Ditto. (GetISOWordType): Ditto. (GetShortCardType): Ditto. (GetM2ShortCardType): Ditto. (GetShortIntType): Ditto. (GetM2ShortIntType): Ditto. (GetM2LongCardType): Ditto. (GetM2LongIntType): Ditto. (GetM2LongRealType): Ditto. (GetM2RealType): Ditto. (GetM2ShortRealType): Ditto. (GetM2IntegerType): Ditto. (GetM2CharType): Ditto. (GetCSizeTType): Ditto. (GetCSSizeTType): Ditto. (BuildArrayStringConstructor): Ditto. (RealToTree): Ditto. (BuildStartRecord): Ditto. (BuildStartUnion): Ditto. (BuildStartVarient): Ditto. (BuildEndVarient): Ditto. (BuildStartFieldVarient): Ditto. (BuildEndFieldVarient): Ditto. (BuildStartFieldRecord): Ditto. (BuildFieldRecord): Ditto. (ChainOn): Ditto. (ChainOnParamValue): Ditto. (AddStringToTreeList): Ditto. (BuildEndRecord): Ditto. (SetAlignment): Ditto. (SetDeclPacked): Ditto. (SetTypePacked): Ditto. (SetRecordFieldOffset): Ditto. (BuildPackedFieldRecord): Ditto. (BuildNumberOfArrayElements): Ditto. (AddStatement): Ditto. (MarkFunctionReferenced): Ditto. (BuildArrayIndexType): Ditto. (GetArrayNoOfElements): Ditto. (BuildEndArrayType): Ditto. (PutArrayType): Ditto. (BuildStartArrayType): Ditto. (IsAddress): Ditto. (SameRealType): Ditto. * m2.flex (Gm2linemap.h): Include. * mc-boot/GDynamicStrings.cc: Rebuild. * mc-boot/GFIO.cc: Ditto. * mc-boot/GIndexing.cc: Ditto. * mc-boot/GM2Dependent.cc: Ditto. * mc-boot/GSArgs.cc: Ditto. * mc-boot/GStringConvert.cc: Ditto. * mc-boot/Gdecl.cc: Ditto. * mc-boot/Gdecl.h: Ditto. * mc-boot/Gdtoa.h: Ditto. * mc-boot/Gkeyc.cc: Ditto. * mc-boot/Gkeyc.h: Ditto. * mc-boot/Glibc.h: Ditto. * mc-boot/GmcComp.cc: Ditto. * mc-boot/GmcLexBuf.cc: Ditto. * mc-boot/GmcPreprocess.cc: Ditto. * mc-boot/GmcStream.cc: Ditto. * mc-boot/Gmcp1.cc: Ditto. * mc-boot/Gmcp3.cc: Ditto. * mc-boot/Gmcp4.cc: Ditto. * mc-boot/Gmcp5.cc: Ditto. * mc-boot/GnameKey.cc: Ditto. * mc-boot/Gvarargs.cc: Ditto. * mc/decl.def (putDefUnqualified): New procedure function. (isDefUnqualified): Ditto. * mc/decl.mod (defT): Add unqualified field. (charStarN): New variable. (constCharStarN): Ditto. (checkGccType): New procedure. (checkCDataTypes): Ditto. (import): Call checkGccType and checkCDataTypes. (putDefUnqualified): New procedure function. (isDefUnqualified): Ditto. * mc/keyc.def (useGccTree): New procedure. (useGccLocation): Ditto. * mc/keyc.mod (checkGccConfigSystem): Call checkGccConfigSystem. (useGccTree): New procedure. (useGccLocation): Ditto. * mc/mcp1.bnf (decl): Import putDefUnqualified. (Export): Call putDefUnqualified. * gm2-gcc/CDataTypes.def: New file. * gm2-gcc/gcctypes.def: New file. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2024-09-02Rename ASM_INPUT_P to ASM_BASIC_PRichard Sandiford2-2/+2
ASM_INPUT_P is so named because it causes the eventual rtl insn pattern to be a top-level ASM_INPUT rather than an ASM_OPERANDS. However, this name has caused confusion, partly due to earlier documentation. The name also sounds related to ASM_INPUTS but is for a different piece of state. This patch renames it to ASM_BASIC_P, with the inverse meaning an extended asm. ("Basic asm" is the term used in extend.texi.) gcc/ * doc/generic.texi (ASM_BASIC_P): Document. * tree.h (ASM_INPUT_P): Rename to... (ASM_BASIC_P): ...this. (ASM_VOLATILE_P, ASM_INLINE_P): Reindent. * gimplify.cc (gimplify_asm_expr): Update after above renaming. * tree-core.h (tree_base): Likewise. gcc/c/ * c-typeck.cc (build_asm_expr): Rename ASM_INPUT_P to ASM_BASIC_P. gcc/cp/ * pt.cc (tsubst_stmt): Rename ASM_INPUT_P to ASM_BASIC_P. * parser.cc (cp_parser_asm_definition): Likewise. gcc/d/ * toir.cc (IRVisitor): Rename ASM_INPUT_P to ASM_BASIC_P. gcc/jit/ * jit-playback.cc (playback::block::add_extended_asm): Rename ASM_INPUT_P to ASM_BASIC_P. gcc/m2/ * gm2-gcc/m2block.cc (flush_pending_note): Rename ASM_INPUT_P to ASM_BASIC_P. * gm2-gcc/m2statement.cc (m2statement_BuildAsm): Likewise.
2024-08-28PR modula2/116181 remove ODR warnings from library interface filesGaius Mulley3-10/+5
This patch removes the warnings generated by -Wodr from the library interface between modula-2 and C. gcc/m2/ChangeLog: PR modula2/116181 * Make-lang.in (MC_SRC_FLAGS): New macro. (m2/mc-boot/$(SRC_PREFIX)%.o): Use MC_SRC_FLAGS. (m2/mc-boot-ch/$(SRC_PREFIX)%.o): Ditto. (m2/gm2-libs-boot/M2RTS.o): Ditto. (m2/gm2-libs-boot/%.o): Ditto. (GM2-LIBS-BOOT-H): New macro. (m2/gm2-libs-boot/RTcodummy.o): Use MC_SRC_FLAGS. Remove gm2-libs-host.h from the dependancy. (m2/gm2-libs-boot/wrapc.o): Use MC_SRC_FLAGS. Add dependancy GM2-LIBS-BOOT-H. (m2/gm2-libs-boot/UnixArgs.o): Ditto. (m2/gm2-libs-boot/choosetemp.o): Ditto. (m2/gm2-libs-boot/errno.o): Ditto. (m2/gm2-libs-boot/dtoa.o): Ditto. (m2/gm2-libs-boot/ldtoa.o): Ditto. (m2/gm2-libs-boot/termios.o): Ditto. (m2/gm2-libs-boot/SysExceptions.o): Ditto. (m2/gm2-compiler-boot/M2GCCDeclare.o): Add gm2-libs-ch to the search path. (m2/gm2-compiler-boot/M2Error.o): Ditto. (m2/gm2-compiler-boot/%.o): Ditto. (m2/pge-boot/%.o): Ditto. * gm2-gcc/m2color.cc (m2color_colorize_start): Replace parameter type char to void and recast to char * when calling colorize_start. * gm2-gcc/m2color.h (m2color_colorize_start): Replace parameter type char to void. * gm2-gcc/m2type.h: Remove #if 0 block. * gm2-libs-ch/SysExceptions.c (DECL_PROC_T): Provide alternative defines for MC an gm2. (PROC_FUNC): Ditto. (EXTERN): Force undefine and redefine. (SysExceptions_InitExceptionHandlers): Rewrite function declaration using defined macros. (_M2_SysExceptions_init): Use EXTERN. (_M2_SysExceptions_finish): Replace with ... (_M2_SysExceptions_fini): ... this and add parameters. * gm2-libs-ch/UnixArgs.cc (gm2-libs-host.h): Include. (GUnixArgs.h): Include. (GM2RTS.h): Include. (UnixArgs_GetArgV): Change return type to void *. (UnixArgs_GetEnvV): Ditto. * gm2-libs-ch/m2rts.h (M2RTS_RegisterModule_Cstr): Add new conditional macro. (M2RTS_RequestDependant): Remove. (M2RTS_RegisterModule): Ditto. (M2RTS_Terminate): Ditto. (M2RTS_DeconstructModules): Ditto. (M2RTS_Halt): Ditto. (_M2_M2RTS_init): Ditto. (M2RTS_ConstructModules): Ditto. * gm2-libs-ch/termios.c (_termios_C): Define. (EXTERN): Add conditional definition. (doSetUnset): New function. (_M2_termios_init): Add correct parameters. (_M2_termios_finish): Ditto. (_M2_termios_fini): Ditto. * mc-boot-ch/GSysExceptions.c (DECL_PROC_T): New define. (PROC_FUNC): Ditto. (EXTERN): Force undef. (SysExceptions_InitExceptionHandlers): Rewrite. * mc-boot-ch/Glibc.c (libc_open): Rename parameter oflag to flags. * mc-boot-ch/Gtermios.cc (_termios_C): New define. (KillTermios): Change parameter type from struct termios * to termios_TERMIOS. (tcsnow): Rewrite. (tcsnow): Rewrite. (tcsdrain): Rewrite. (tcsflush): Rewrite. (cfgetospeed): Rewrite. (cfgetispeed): Rewrite. (cfsetospeed): Rewrite. (cfsetispeed): Rewrite. (cfsetspeed): Rewrite. (cfsetspeed): Rewrite. (tcgetattr): Rewrite. (tcsetattr): Rewrite. (cfmakeraw): Rewrite. (tcsendbreak): Rewrite. (tcdrain): Rewrite. (tcflushi): Rewrite. (tcflusho): Rewrite. (tcflushio): Rewrite. (tcflowoni): Rewrite. (tcflowoffi): Rewrite. (tcflowono): Rewrite. (tcflowoffo): Rewrite. (GetFlag): Rewrite. (SetFlag): Rewrite. (GetChar): Rewrite. (SetChar): Rewrite. (InitTermios): Rewrite. * pge-boot/GM2RTS.cc: Regenerate. * pge-boot/GSysExceptions.cc: Ditto. * pge-boot/Gtermios.cc: Ditto. * pge-boot/m2rts.h: Rewrite. * mc-boot-ch/GSYSTEM.h: New file. * mc-boot-ch/GSysExceptions.h: New file. * mc-boot-ch/Gtermios.h: New file. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2024-07-28PR modula2/115823 Wrong expansion of isnormal optabGaius Mulley1-2/+2
This patch corrects the function declaration of a builtin (using the libname rather than the source name). gcc/m2/ChangeLog: PR modula2/115823 * gm2-gcc/m2builtins.cc (define_builtin): Build the function decl using the libname. gcc/testsuite/ChangeLog: PR modula2/115823 * gm2/builtins/run/pass/testisnormal.mod: Change to an implementation module. * gm2/builtins/run/pass/testisnormal.def: New test. * gm2/builtins/run/pass/testsinl.def: New test. * gm2/builtins/run/pass/testsinl.mod: New test. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2024-07-23PR modula2/116048 ICE when encountering wrong kind of qualidentGaius Mulley1-0/+4
Following on from PR-115957 further ICEs can be generated by using the wrong kind of qualident symbol. For example using a variable instead of a type or using a type instead of a const. This fix tracks the expected qualident kind state when parsing const, type and variable declarations. If the error is unrecoverable then a detailed message explaining the context of the qualident (and why the seen qualident is wrong) is generated. gcc/m2/ChangeLog: PR modula2/116048 * Make-lang.in (GM2-COMP-BOOT-DEFS): Add M2StateCheck.def. (GM2-COMP-BOOT-MODS): Add M2StateCheck.mod. (GM2-COMP-DEFS): Add M2StateCheck.def. (GM2-COMP-MODS): Add M2StateCheck.mod. * gm2-compiler/M2Quads.mod (StartBuildWith): Generate unrecoverable error is the qualident type is NulSym. Replace MetaError1 with MetaErrorT1 and position the error to the qualident. * gm2-compiler/P3Build.bnf (M2StateCheck): Import procedures. (seenError): New variable. (WasNoError): Remove variable. (BlockState): New variable. (ErrorString): Rewrite using seenError. (CompilationUnit): Ditto. (QualidentCheck): New rule. (ConstantDeclaration): Bookend with InclConst and ExclConst. (Constructor): Add InclConstructor, ExclConstructor and call CheckQualident. (ConstActualParameters): Call PushState, PopState, InclConstFunc and CheckQualident. (TypeDeclaration): Bookend with InclType and ExclType. (SimpleType): Call QualidentCheck. (CaseTag): Ditto. (OptReturnType): Ditto. (VariableDeclaration): Bookend with InclVar and ExclVar. (Designator): Call QualidentCheck. (Formal;Type): Ditto. * gm2-compiler/PCBuild.bnf (M2StateCheck): Import procedures. (ConstantDeclaration): Rewrite using InclConst and ExclConst. (Constructor): Bookend with InclConstructor and ExclConstructor. Call CheckQualident. (ConstructorOrConstActualParameters): Rewrite and cal l CheckQualident. (ConstActualParameters): Bookend with PushState PopState. Call InclConstFunc and CheckQualident. * gm2-gcc/init.cc (_M2_M2StateCheck_init): New declaration. (_M2_P3Build_init): New declaration. (init_PerCompilationInit): Call _M2_M2StateCheck_init and _M2_P3Build_init. * gm2-compiler/M2StateCheck.def: New file. * gm2-compiler/M2StateCheck.mod: New file. gcc/testsuite/ChangeLog: PR modula2/116048 * gm2/errors/fail/errors-fail.exp: Remove -Wstudents and add -Wuninit-variable-checking=all. Replace gm2_init_pim with gm2_init_iso. * gm2/errors/fail/testfio.mod: Modify test code to provoke an error in the first basic block. * gm2/errors/fail/testparam.mod: Ditto. * gm2/errors/fail/array1.mod: Ditto. * gm2/errors/fail/badtype.mod: New test. * gm2/errors/fail/badvar.mod: New test. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2024-07-12modula2: bootstrap fix for string and vector headers.FX Coudert1-1/+1
This patch fixes the include of headers (<string> and <vector>) which are included after GCC's system.h has been included. It defines INCLUDE_STRING before including "system.h". This allows gcc to bootstrap with Apple clang 15. gcc/m2/ChangeLog: * gm2-gcc/m2linemap.cc (INCLUDE_STRING): Define before include of gcc-consolidation.h. * gm2spec.cc (INCLUDE_STRING): Define before include of system.h. (INCLUDE_VECTOR): Ditto. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2024-07-10PR modula2/115823 Wrong expansion of isnormal optabGaius Mulley1-5/+26
The bug fix changes gcc/m2/gm2-gcc/m2builtins.c:m2builtins_BuiltinExists to recognise both __builtin_<functionname> and functionname as a builtin. gcc/m2/ChangeLog: PR modula2/115823 * gm2-gcc/m2builtins.cc (struct builtin_macro_definition): New field builtinname. (builtin_function_match): New function. (builtin_macro_match): Ditto. (m2builtins_BuiltinExists): Use builtin_function_match and builtin_macro_match. (lookup_builtin_macro): Use builtin_macro_match. (lookup_builtin_function): Use builtin_function_match. (define_builtin): Assign builtinname field. gcc/testsuite/ChangeLog: PR modula2/115823 * gm2/builtins/run/pass/testalloa.mod: New test. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2024-07-07PR modula2/115804 ICE during gimplification with new isfinite optabGaius Mulley1-11/+15
The calls to five m2 builtins have the incorrect return type. This was detected when adding isfinitedf2 optab to the s390 backend which results in ICEs during gimplification in the gm2 testsuite. gcc/m2/ChangeLog: PR modula2/115804 * gm2-gcc/m2builtins.cc (builtin_function_entry): Add GTY. (DoBuiltinMemCopy): Add rettype and use rettype in the call. (DoBuiltinAlloca): Ditto. (DoBuiltinIsfinite): Ditto. (DoBuiltinIsnan): Ditto. (m2builtins_BuiltInHugeVal): Ditto. (m2builtins_BuiltInHugeValShort): Ditto. (m2builtins_BuiltInHugeValLong): Ditto. Co-Authored-By: Stefan Schulze Frielinghaus <stefansf@linux.ibm.com> Co-Authored-By: Andrew Pinski <quic_apinski@quicinc.com> Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2024-06-16m2: Remove uses of {FLOAT,{,LONG_}DOUBLE}_TYPE_SIZEKewen Lin1-3/+4
Joseph pointed out "floating types should have their mode, not a poorly defined precision value" in the discussion[1], as he and Richi suggested, the existing macros {FLOAT,{,LONG_}DOUBLE}_TYPE_SIZE will be replaced with a hook mode_for_floating_type. To be prepared for that, this patch is to remove uses of {FLOAT,{,LONG_}DOUBLE}_TYPE_SIZE in m2. Currently they are used for assertion and can be replaced with TYPE_SIZE check on the corresponding type node, since we dropped the call to layout_type which would early return once TYPE_SIZE is set and this assertion ensures it's safe to drop that call. [1] https://gcc.gnu.org/pipermail/gcc-patches/2024-May/651209.html gcc/m2/ChangeLog: * gm2-gcc/m2type.cc (build_m2_short_real_node): Adjust assertion with TYPE_SIZE check. (build_m2_real_node): Likewise. (build_m2_long_real_node): Add assertion with TYPE_SIZE check.
2024-06-06modula2: Simplify REAL/LONGREAL/SHORTREAL node creation.Gaius Mulley1-23/+7
This patch simplifies the real type build functions by using the default float_type_node, double_type_node rather than create new nodes. It also uses the default GCC long_double_type_node or float128_type_nodes for longreal. gcc/m2/ChangeLog: * gm2-gcc/m2type.cc (build_m2_short_real_node): Rewrite to use the default float_type_node. (build_m2_real_node): Rewrite to use the default double_type_node. (build_m2_long_real_node): Rewrite to use the default long_double_type_node or float128_type_node. Co-Authored-By: Kewen.Lin <linkw@linux.ibm.com> Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2024-05-02PR modula2/113836 gm2 does not dump gimple or quadruples to a fileGaius Mulley4-6/+29
This patch completes the implementation of dumping the intermediate forms to file. It implements the filtering on symbol rules. Filtering can be performed through the full text name (given to the GCC tree) or qualified modula-2 symbol or filename:qualident. gcc/ChangeLog: PR modula2/113836 * doc/gm2.texi (Compiler options): Add -fm2-debug-trace=, -fm2-dump, -fm2-dump-decl=, -fm2-dump-gimple=, -fm2-dump-quad= and -fm2-dump-filter=. gcc/m2/ChangeLog: PR modula2/113836 * gm2-compiler/M2AsmUtil.def: Remove export qualified and unused import. * gm2-compiler/M2LangDump.mod (AddRuleTextDump): New procedure. (AddRuleScopeQualidentDump): Add warning check against unmatched rule. (GenQualidentSymString): New procedure function. (IdentQualidentMatch): New procedure function. (IsRuleFilenameMatch): New procedure function. (CheckRuleMatch): New procedure function. (AddRuleFilenameDump): New procedure function. * gm2-gcc/m2misc.cc (m2misc_warning_m2_dump_filter): New function. * gm2-gcc/m2misc.def (warning_m2_dump_filter): New procedure. * gm2-gcc/m2misc.h (m2misc_warning_m2_dump_filter): New prototype. * gm2-gcc/m2pp.cc (VERBOSE_TYPE_DESC): New define. (m2pp_identifier): Define out verbose type info. (m2pp_constructor): Define out verbose type info. (m2pp_assignment): Define out verbose type info. * gm2-lang.cc (ENABLE_M2DUMP_ALL): Remove. * lang.opt (fm2-dump): Add. (fm2-dump-decl=): Add. (fm2-dump-gimple=): Add. (fm2-dump-quad=): Add. (fm2-dump-filter=): Add. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2024-04-16PR modula2/114745: const cast causes ICEGaius Mulley3-12/+38
This patch allows SYSTEM.CAST to be used during a const expression and prevents an ICE. gcc/m2/ChangeLog: PR modula2/114745 * gm2-compiler/M2Code.mod (DumpLangDecl): Replace with ... (GetDumpDecl): ... this. (DumpLangGimple): Replace with ... (GetDumpGimple): ... this. * gm2-compiler/M2GenGCC.mod: * gm2-compiler/M2LangDump.mod (GetDumpLangQuadFilename): Replace with ... (GetDumpQuadFilename): ... this. (GetDumpLangDeclFilename): Replace with ... (GetDumpDeclFilename): ... this. (GetDumpLangGimpleFilename): Replace with ... (GetDumpGimpleFilename): ... this. * gm2-compiler/M2Options.def (GetDumpLangDeclFilename): New procedure function. (GetDumpDeclFilename): Ditto. (SetDumpLangDeclFilename): New procedure. (SetDumpDeclFilename): Ditto. (GetDumpLangQuadFilename): New procedure function. (GetDumpQuadFilename): Ditto (SetDumpLangQuadFilename): New procedure. (SetDumpQuadFilename): Ditto. (GetDumpLangGimpleFilename): New procedure function. (GetDumpGimpleFilename): Ditto. (SetDumpLangGimpleFilename): New procedure. (SetDumpGimpleFilename): Ditto. (GetDumpLangGimple): New procedure function. (SetM2Dump): New procedure. (GetDumpGimple): New procedure function. (GetDumpQuad): Ditto. (GetDumpDecl): Ditto. * gm2-compiler/M2Options.mod (DumpLangDeclFilename): Remove. (DumpLangQuadFilename): Ditto. (DumpLangGimpleFilename): Ditto. (DumpDeclFilename): New variable. (DumpQuadFilename): Ditto. (DumpGimpleFilename): Ditto. (DebugTraceTree): New variable. (SetQuadDebugging): Rewrite. (GetDumpLangDeclFilename): Replace with ... (GetDumpDeclFilename): ... this. (SetDumpLangQuadFilename): Replace with ... (SetDumpQuadFilename): ... this. (GetDumpLangGimpleFilename): Replace with ... (GetDumpGimpleFilename): ... this. (SetDumpLangGimpleFilename): Replace with ... (SetDumpGimpleFilename): ... this. (GetDumpLangGimple): Remove. (MatchDump): New procedure function. (SetM2Dump): New procedure. (GetDumpGimple): New procedure function. (GetDumpQuad): Ditto. (GetDumpDecl): Ditto. (GetDumpLangGimple): Ditto. * gm2-compiler/M2Quads.mod (BreakAtQuad): Assigned to 140. (BuildTypeCoercion): Add ConstExpr parameter. Check for const parameter in a const expression. Create a constant temporary if in a const expression. (BuildCastFunction): Pass ConstExpr to BuildTypeCoercion. (BuildFunctionCall): Pass ConstExpr to BuildTypeCoercion. * gm2-compiler/PCSymBuild.mod (buildConstFunction): Test for Cast and call InitConvert. (ErrorConstFunction): Add CAST to the error message. * gm2-compiler/SymbolTable.mod (GetConstStringContent): Remove unused procedure. * gm2-gcc/m2decl.cc (m2decl_DeclareKnownConstant): Copy value and change type of value. * gm2-gcc/m2options.h (M2Options_GetDumpLangDeclFilename): Remove. (M2Options_SetDumpLangDeclFilename): Ditto. (M2Options_GetDumpLangQuadFilename): Ditto. (M2Options_SetDumpLangQuadFilename): Ditto. (M2Options_GetDumpLangGimpleFilename): Ditto. (M2Options_SetDumpLangGimpleFilename): Ditto. (M2Options_GetDumpLangGimple): Ditto. (M2Options_GetDumpDeclFilename): New function. (M2Options_SetDumpDeclFilename): Ditto. (M2Options_GetDumpQuadFilename): Ditto. (M2Options_SetDumpQuadFilename): Ditto. (M2Options_GetDumpGimpleFilename): Ditto. (M2Options_SetDumpGimpleFilename): Ditto. (M2Options_SetM2Dump): Ditto. (M2Options_GetDumpGimple): Ditto. * gm2-gcc/m2pp.cc (GM2): New define. (m2pp_type_lowlevel): Remove linefeed. (m2pp_identifier): Add type description for const. (m2pp_assignment): Display lhs/rhs types. (m2pp_dump_gimple): Replace GetDumpLangGimple with GetDumpGimple. * gm2-lang.cc (ENABLE_QUAD_DUMP_ALL): Remove. (ENABLE_M2DUMP_ALL): New define. (gm2_langhook_handle_option): Remove commented options OPT_fdump_lang_all, OPT_fdump_lang_decl_, OPT_fdump_lang_gimple, OPT_fdump_lang_gimple_, OPT_fdump_lang_quad and OPT_fdump_lang_quad_. Add commented options OPT_fm2_dump_, OPT_fm2_dump_decl_, OPT_fm2_dump_gimple_ and OPT_fm2_dump_quad_. gcc/testsuite/ChangeLog: PR modula2/114745 * gm2/iso/const/pass/constcast.mod: New test. * gm2/iso/const/pass/constodd.mod: New test. * gm2/pim/pass/tinyindr.mod: New test. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2024-04-06PR modula2/114617 gm2 unable to resolve const expressions using relop ICEGaius Mulley3-0/+17
This patch allows cc1gm2 to resolve constant expressions which use relative operators. Previous to the patch the result of a relop was stored in a temporary variable set by an if then else quadruple sequence. This patch marks a const expression in the quadruples and then reduces this sequence of quadruples into a single assignment to an internal constant. gcc/m2/ChangeLog: PR modula2/114617 * gm2-compiler/M2GenGCC.mod (CodeStatememt): Add quad trace. (ResolveConstantExpressions): Add parameter p to FoldIfLess, FoldIfGre, FoldIfLessEqu, FoldIfGreEqu, FoldIfEqu, FoldIfNotEqu, FoldIfIn and FoldIfNotIn. (CodeInline): Add constExpr variable and pass it to GetQuadOtok. (CodeReturnValue): Ditto. (CodeParam): Ditto. (FoldStringLength): Ditto. (FoldStringConvertM2nul): Ditto. (FoldStringConvertCnul): Ditto. (DeclaredOperandsBecomes): Ditto. (TypeCheckBecomes): Ditto. (PerformFoldBecomes): Ditto. (CodeBecomes): Ditto. (CheckElementSetTypes): Ditto. (CodeBinarySet): Ditto. (PerformCodeIfLess): Ditto. (PerformCodeIfGre): Ditto. (PerformCodeIfLessEqu): Ditto. (PerformCodeIfGreEqu): Ditto. (PerformCodeIfEqu): Ditto. (PerformCodeIfNotEqu): Ditto. (IsValidExpressionRelOp): Ditto. (PerformCodeIfIn): Ditto. (PerformCodeIfNotIn): Ditto. (CodeXIndr): Ditto. (QuadCondition): New procedure function. (IsBooleanRelOpPattern): Ditto. (FoldBooleanRelopPattern): Ditto. (FoldIfGre): Check for boolean relop constant expression and add parameter p. (FoldIfLessEqu): Ditto. (FoldIfIn): Ditto. (FoldIfEqu): Ditto. (FoldIfNotIn): Ditto. (FoldIfGreEqu): New procedure. (FoldIfNotEqu): Ditto. * gm2-compiler/M2Optimize.mod (ReduceBranch): Add constExpr variable and pass it to GetQuadOtok. * gm2-compiler/M2Quads.def (IsBecomes): New procedure function. (IsDummy): Ditto. (IsQuadConstExpr): Ditto. (SetQuadConstExpr): Ditto. (GetQuadDest): New procedure. (GetQuadOp1): New procedure. (GetQuadOp2): New procedure. (GetQuadOp3): New procedure. (GetQuadOtok): New procedure. (GetQuadOTypetok): New procedure. (PutQuadOtok): New procedure. (IsInConstParameters): New procedure function. * gm2-compiler/M2Quads.mod (IsBecomes): New procedure function. (IsDummy): Ditto. (IsQuadConstExpr): Ditto. (SetQuadConstExpr): Ditto. (GetQuadDest): New procedure. (GetQuadOp1): New procedure. (GetQuadOp2): New procedure. (GetQuadOp3): New procedure. (GetQuadOtok): New procedure. (GetQuadOTypetok): New procedure. (PutQuadOtok): New procedure. (IsInConstParameters): New procedure function. (ConstStack): Remove to ... (ConstExprStack): ... this. (ConstParamStack): New variable and initialize. (QuadFrame): New field ConstExpr. (GetQuadOtok): Add parameter constExpr and assign. (PutQuadOtok): Add constExpr parameter and assign. (PutQuadOType): Ditto. (GetQuadOTypetok): Ditto. (EraseQuad): Assign ConstExpr to FALSE. (FoldSubrange): Set ConstExpr to FALSE in BecomesOp. (PushInConstParameters): New procedure. (PopInConstParameters): New procedure. (IsInConstParameters): New procedure function. * gm2-compiler/M2SymInit.mod (IssueConditional): Add constExpr boolean variable. (CheckReadBeforeInitQuad): Ditto. (trashParam): Ditto. * gm2-compiler/P3Build.bnf (ConstExpression): Call PushInConstExpression and PopInConstExpression. (ConstSetOrQualidentOrFunction): Call PushInConstParameters and PopInConstParameters. * gm2-compiler/PCBuild.bnf (ConstExpression): Call PushInConstExpression and PopInConstExpression. * gm2-compiler/PHBuild.bnf: Ditto * gm2-gcc/m2expr.cc (m2expr_BuildCondIfExpression): New function. * gm2-gcc/m2expr.def (BuildCondIfExpression): New prototype. * gm2-gcc/m2expr.h (m2expr_BuildCondIfExpression): New function. gcc/testsuite/ChangeLog: PR modula2/114617 * gm2/iso/const/pass/iso-const-pass.exp: New test. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2024-04-02PR modula2/114565 progress trace would be useful to isolate ICE for usersGaius Mulley5-2/+29
This patch introduces the internal option -fm2-debug-trace= which can be given a comma separated list of filter terms. Currently it allows: all,line,token,quad. The patch allows users to trace the progress of cc1gm2 so that source which causes an ICE can be reduced. Once PR113836 is complete it is expected that the trace information will be written to file. gcc/m2/ChangeLog: PR modula2/114565 * gm2-compiler/M2GenGCC.mod (CodeStatement): Test GetDebugTraceQuad before calling DisplayQuad. * gm2-compiler/M2LexBuf.mod (NumberIO): Import CardToStr. (GetToken): Test GetDebugTraceToken before writing the token number or token line. * gm2-compiler/M2Options.def (SetDebugTraceQuad): Rename to (SetM2DebugTraceFilter): ...this. (SetDebugTraceAPI): Remove. (GetDebugTraceQuad): New procedure function. (GetDebugTraceTree): Ditto. (GetDebugTraceToken): Ditto. (GetDebugTraceLine): Ditto. (GetDebugFunctionLineNumbers): Ditto. * gm2-compiler/M2Options.mod (DebugFunctionLineNumbers): New boolean variable. (DebugTraceQuad): Ditto. (DebugTraceTree): Ditto. (DebugTraceLine): Ditto. (DebugTraceToken): Ditto. (errors1): New procedure. (SetDebugTraceQuad): Remove. (SetM2DebugTraceFilter): New procedure implemented. (SetM2DebugTrace): Ditto. (GetDebugTraceQuad): Ditto. (GetDebugTraceToken ): Ditto. (GetDebugTraceLine): Ditto. (SetDebugTraceLine): Remove. * gm2-compiler/M2Quads.mod (GenQuadOTrash): Test GetDebugTraceQuad and call DisplayQuad. (GenQuadOTypetok): Ditto. * gm2-compiler/SymbolTable.mod: Replace DebugFunctionLineNumbers with GetDebugFunctionLineNumbers. * gm2-gcc/init.cc (_M2_M2LangDump_init): Add prototype. (init_PerCompilationInit): Add call. * gm2-gcc/m2misc.cc (m2misc_cerror): New function. (m2misc_error): Ditto. * gm2-gcc/m2misc.def (error): New procedure. (cerror): Ditto. * gm2-gcc/m2misc.h (m2misc_cerror): New prototype. (m2misc_error): Ditto. * gm2-gcc/m2options.h (M2Options_SetDebugTraceQuad): New prototype. (M2Options_SetDebugTraceAPI): Remove. (M2Options_GetDebugTraceToken): New prototype. (M2Options_GetDebugTraceLine): Ditto. (M2Options_SetDebugFunctionLineNumbers): Ditto. (M2Options_GetDebugFunctionLineNumbers): Ditto. (M2Options_SetM2DebugTraceFilter): Ditto. * gm2-lang.cc (gm2_langhook_init_options): Remove OPT_fdebug_trace_quad case. Remove OPT_fdebug_trace_api case. Add OPT_fm2_debug_trace_ case. * lang.opt (fm2-debug-trace): New option. (fdebug-trace-api): Remove. (fdebug-trace-quad): Remove. * m2.flex (m2flex_M2Error): Check s for NULL. (skipnewline): New function. (consumeLine): Call traceline. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2024-03-28PR modula2/114517 gm2 does not allow comparison operator hash in column oneGaius Mulley1-0/+1
This patch allows -fno-cpp to be supplied to gm2. Without this patch it causes an ICE. The patch allows -fno-cpp to turn off cpp flags. These are tested in m2.flex to decide whether a change of state is allowed (enabling handling of #line directives). gcc/ChangeLog: PR modula2/114517 * doc/gm2.texi: Mention gm2 treats a # in the first column as a preprocessor directive unless -fno-cpp is supplied. gcc/m2/ChangeLog: PR modula2/114517 * gm2-compiler/M2Options.def (SetCpp): Add comment. (GetCpp): Move after SetCpp. (GetLineDirectives): New procedure function. * gm2-compiler/M2Options.mod (GetLineDirectives): New procedure function. * gm2-gcc/m2options.h (M2Options_GetLineDirectives): New prototype. * gm2-lang.cc (gm2_langhook_init_options): OPT_fcpp only assert if !value. * m2.flex: Test GetLineDirectives before changing to LINE0 state. gcc/testsuite/ChangeLog: PR modula2/114517 * gm2/cpp/fail/hashfirstcolumn2.mod: New test. * gm2/imports/fail/imports-fail.exp: New test. * gm2/imports/fail/localmodule2.mod: New test. * gm2/imports/run/pass/localmodule.mod: New test. Signed-off-by: Gaius Mulley <(no_default)>
2024-03-26PR modula2/114478 isnormal builtin unavailable from m2Gaius Mulley1-27/+120
This patch adds isnormal (and isgreater, isless, isgreaterequal, islessequal, islessgreater, isunordered) c99 macro similar prototyped builtins to m2. gcc/m2/ChangeLog: PR modula2/114478 * gm2-gcc/m2builtins.cc (struct builtin_macro_definition): New struct. (lookup_builtin_macro): New function. (m2builtins_BuildBuiltinTree): Rewrite to lookup builtin function and builtin macro. (lookup_builtin_function): New function. (define_builtin): Rename parameter type to prototype push macro definition to builtin_macros vector. (define_builtin_ext): New function. (define_builtin_math): New function. (m2builtins_init): Add isgreater, isless, isgreaterequal, islessequal, islessgreater, isunordered, isnormal to macro definitions. * gm2-libs/Builtins.def (isgreater): New procedure function. (isgreaterf): Ditto. (isgreaterl): Ditto. (isgreaterequal): Ditto. (isgreaterequalf): Ditto. (isgreaterequall): Ditto. (isless): Ditto. (islessf): Ditto. (islessl): Ditto. (islessequal): Ditto. (islessequalf): Ditto. (islessequall): Ditto. (islessgreater): Ditto. (islessgreaterf): Ditto. (islessgreaterl): Ditto. (isunordered): Ditto. (isunorderedf): Ditto. (isunorderedl): Ditto. (iseqsig): Ditto. (iseqsigf): Ditto. (iseqsigl): Ditto. (isnormal): Ditto. (isnormalf): Ditto. (isnormall): Ditto. (isinf_sign): Ditto. (isinf_signf): Ditto. (isinf_signl): Ditto. * gm2-libs/Builtins.mod (isgreater): New procedure function. (isgreaterf): Ditto. (isgreaterl): Ditto. (isgreaterequal): Ditto. (isgreaterequalf): Ditto. (isgreaterequall): Ditto. (isless): Ditto. (islessf): Ditto. (islessl): Ditto. (islessequal): Ditto. (islessequalf): Ditto. (islessequall): Ditto. (islessgreater): Ditto. (islessgreaterf): Ditto. (islessgreaterl): Ditto. (isunordered): Ditto. (isunorderedf): Ditto. (isunorderedl): Ditto. (iseqsig): Ditto. (iseqsigf): Ditto. (iseqsigl): Ditto. (isnormal): Ditto. (isnormalf): Ditto. (isnormall): Ditto. (isinf_sign): Ditto. (isinf_signf): Ditto. (isinf_signl): Ditto. gcc/testsuite/ChangeLog: PR modula2/114478 * gm2/builtins/run/pass/builtins-run-pass.exp: New test. * gm2/builtins/run/pass/testcomparisons.mod: New test. * gm2/builtins/run/pass/testisnormal.mod: New test. * gm2/pimlib/run/pass/testchar.mod: New test. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2024-03-21PR modula2/113836 gm2 does not dump gimple or quadruples to fileGaius Mulley7-4/+3016
This patch provides the localized modula2 changes to gcc/m2 which facilitate the dumping of gimple and quadruples to file. PR modula2/113836 will be full complete after a subsequent patch adding changes to lang.opt and documentation. The lang.opt patch requires all language bootstrap regression testing whereas this patch is isolated to gcc/m2 and only the m2 language. gcc/m2/ChangeLog: PR modula2/113836 * Make-lang.in (GM2_C_OBJS): Add m2/gm2-gcc/m2pp.o. (m2/m2pp.o): Remove rule. (GM2-COMP-BOOT-DEFS): Add M2LangDump.def. (GM2-COMP-BOOT-MODS): Add M2LangDump.mod. (GM2-GCC-DEFS): Add M2LangDump.def. (GM2-GCC-MODS): Add M2LangDump.mod. * gm2-compiler/M2CaseList.mod (WriteCase): Rewrite. * gm2-compiler/M2Code.mod (DoModuleDeclare): Call DumpFilteredResolver depending upon DumpLangDecl. (DoCodeBlock): Call CreateDumpGimple depending upon DumpLangGimple. (Code): Replace DisplayQuadList blocks with DumpQuadruples. (DisplayQuadsInScope): Remove. (DisplayQuadNumbers): Remove. (CodeBlock): Rewrite. * gm2-compiler/M2GCCDeclare.def (IncludeDumpSymbol): New procedure. (DumpFilteredResolver): New procedure. (DumpFilteredDefinitive): New procedure. * gm2-compiler/M2GCCDeclare.mod (IncludeDumpSymbol): New procedure. (DumpFilteredResolver): New procedure. (DumpFilteredDefinitive): New procedure. (doInclude): Rewrite to use GetDumpFile. (WatchIncludeList): Remove fixed debugging value. (doExclude): Rewrite to use GetDumpFile. (DeclareTypesConstantsProceduresInRange): Remove fixed debugging values. (PreAddModGcc): Rename parameter t as tree. (IncludeGetNth): Rewrite to use GetDumpFile. (IncludeType): Ditto. (IncludeSubscript): Ditto. (PrintLocalSymbol): Ditto. (PrintLocalSymbols): Ditto. (IncludeGetVarient): Ditto. (PrintDeclared): Ditto. (PrintAlignment): Ditto. (PrintDecl): Ditto. (PrintScope): Ditto. (PrintProcedure): Ditto. (PrintSym): Ditto. (PrintSymbol): Ditto. (PrintTerse): Ditto. * gm2-compiler/M2Options.def (GetDumpLangDeclFilename): New procedure function. (SetDumpLangDeclFilename): New procedure. (GetDumpLangQuadFilename): New procedure function. (SetDumpLangQuadFilename): New procedure. (GetDumpLangGimpleFilename): New procedure function. (SetDumpLangGimpleFilename): New procedure. (SetM2DumpFilter): New procedure. (GetM2DumpFilter): New procedure function. (GetDumpLangGimple): New procedure function. * gm2-compiler/M2Options.mod (GetDumpLangDeclFilename): New procedure function. (SetDumpLangDeclFilename): New procedure. (GetDumpLangQuadFilename): New procedure function. (SetDumpLangQuadFilename): New procedure. (GetDumpLangGimpleFilename): New procedure function. (SetDumpLangGimpleFilename): New procedure. (SetM2DumpFilter): New procedure. (GetM2DumpFilter): New procedure function. (GetDumpLangGimple): New procedure function. * gm2-compiler/M2Quads.def (DumpQuadruples): New procedure. * gm2-compiler/M2Quads.mod (DumpUntil): New procedure. (GetCtorInit): New procedure function. (GetCtorFini): New procedure function. (DumpQuadrupleFilter): New procedure function. (DumpQuadrupleAll): New procedure. (DisplayQuadList): Remove procedure. (DumpQuadruples): New procedure. (DisplayQuadRange): Rewrite. (DisplayQuad): Ditto. (DisplayProcedureAttributes): Ditto. (WriteOperator): Ditto. (WriteMode): Ditto. * gm2-compiler/M2Scope.mod (ForeachScopeBlockDo2): Replace DisplayQuadruples with TraceQuadruples. (ForeachScopeBlockDo3): Replace DisplayQuadruples with TraceQuadruples. * gm2-compiler/SymbolConversion.def (Gcc2Mod): New procedure function. * gm2-compiler/SymbolConversion.mod: New procedure function. * gm2-gcc/m2misc.cc (m2misc_DebugTree): New function. (m2misc_DebugTreeChain): New function. * gm2-gcc/m2options.h (M2Options_GetDumpLangDeclFilename): New prototype. (M2Options_SetDumpLangDeclFilename): New prototype. (M2Options_GetDumpLangQuadFilename): New prototype. (M2Options_SetDumpLangQuadFilename): New prototype. (M2Options_GetDumpLangGimpleFilename): New prototype. (M2Options_SetDumpLangGimpleFilename): New prototype. (M2Options_GetDumpLangGimple): New prototype. (M2Options_SetM2DumpFilter): New prototype. (M2Options_GetM2DumpFilter): New prototype. * m2pp.cc: Move to... * gm2-gcc/m2pp.cc: ...here. * m2pp.h: Move to... * gm2-gcc/m2pp.h: ...here. * gm2-gcc/m2statement.cc (m2statement_BuildEndFunctionCode): Call m2pp_dump_gimple. * gm2-lang.cc (ENABLE_QUAD_DUMP_ALL): New define. (gm2_langhook_init_options): Add switch cases for proposed new command line options. * gm2-libs/DynamicStrings.def (ReverseIndex): New procedure function. * gm2-libs/DynamicStrings.mod: New procedure function. * gm2-compiler/M2LangDump.def: New file. * gm2-compiler/M2LangDump.mod: New file. * gm2-gcc/m2langdump.h: New file. * gm2-gcc/m2pp.def: New file. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2024-03-07PR modula2/109969 Linking large project causes an ICEGaius Mulley1-0/+2
This patch contains a re-write of M2LexBuf.mod which removes the linked list of token buckets and simplifies the implementation using a dynamic array. It contains more checking (for empty source files for example). The patch also contains a fix for an ICE in gcc/m2/gm2-gcc/builtins.cc gcc/m2/ChangeLog: PR modula2/109969 * gm2-compiler/M2LexBuf.def (TokenToLineNo): Rename parameter. (TokenToColumnNo): Rename parameter. (TokenToLocation): Rename parameter. (FindFileNameFromToken): Rename parameter. (DumpTokens): Rewrite comment. * gm2-compiler/M2LexBuf.mod: Rewrite. * gm2-compiler/P0SyntaxCheck.bnf (CheckInsertCandidate): DumpTokens before and after inserting recovery token. * gm2-gcc/m2builtins.cc (do_target_support_exists): Add bf_c99_compl case. * gm2-libs/Indexing.def (InitIndexTuned): New procedure function. (IsEmpty): New procedure function. * gm2-libs/Indexing.mod (InitIndexTuned): New procedure function. (IsEmpty): New procedure function. (Index): New field GrowFactor. (PutIndice): Use GrowFactor to extend dynamic array. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2024-01-18PR modula2/111956 Many powerpc platforms do _not_ have support for IEEE754Gaius Mulley5-98/+31
This patch corrects commit r14-4149-g81d5ca0b9b8431f1bd7a5ec8a2c94f04bb0cf032 which assummed all powerpc platforms would have IEEE754 long double. The patch ensures that cc1gm2 obtains the default IEEE754 long double availability from the configure generated tm_defines. The user command line switches -mabi=ibmlongdouble and -mabi=ieeelongdouble are implemented to override the configuration defaults. Bootstrapped on power8 and power9 machines. gcc/m2/ChangeLog: PR modula2/111956 * Make-lang.in (host_mc_longreal): Remove. * configure: Regenerate. * configure.ac (M2C_LONGREAL_FLOAT128): Remove. (M2C_LONGREAL_PPC64LE): Remove. * gm2-compiler/M2Options.def (SetIBMLongDouble): New procedure. (GetIBMLongDouble): New procedure function. (SetIEEELongDouble): New procedure. (GetIEEELongDouble): New procedure function. * gm2-compiler/M2Options.mod (SetIBMLongDouble): New procedure. (GetIBMLongDouble): New procedure function. (SetIEEELongDouble): New procedure. (GetIEEELongDouble): New procedure function. (InitializeLongDoubleFlags): New procedure called during module block initialization. * gm2-gcc/m2configure.cc: Remove duplicate includes. (m2configure_M2CLongRealFloat128): Remove. (m2configure_M2CLongRealIBM128): Remove. (m2configure_M2CLongRealLongDouble): Remove. (m2configure_M2CLongRealLongDoublePPC64LE): Remove. (m2configure_TargetIEEEQuadDefault): New function. * gm2-gcc/m2configure.def (M2CLongRealFloat128): Remove. (M2CLongRealIBM128): Remove. (M2CLongRealLongDouble): Remove. (M2CLongRealLongDoublePPC64LE): Remove. (TargetIEEEQuadDefault): New function. * gm2-gcc/m2configure.h (m2configure_M2CLongRealFloat128): Remove. (m2configure_M2CLongRealIBM128): Remove. (m2configure_M2CLongRealLongDouble): Remove. (m2configure_M2CLongRealLongDoublePPC64LE): Remove. (m2configure_TargetIEEEQuadDefault): New function. * gm2-gcc/m2options.h (M2Options_SetIBMLongDouble): New prototype. (M2Options_GetIBMLongDouble): New prototype. (M2Options_SetIEEELongDouble): New prototype. (M2Options_GetIEEELongDouble): New prototype. * gm2-gcc/m2type.cc (build_m2_long_real_node): Re-implement using results of M2Options_GetIBMLongDouble and M2Options_GetIEEELongDouble. * gm2-lang.cc (gm2_langhook_handle_option): Add case OPT_mabi_ibmlongdouble and call M2Options_SetIBMLongDouble. Add case OPT_mabi_ieeelongdouble and call M2Options_SetIEEELongDouble. * gm2config.aci.in: Regenerate. * gm2spec.cc (lang_specific_driver): Remove block defined by M2C_LONGREAL_PPC64LE. Remove case OPT_mabi_ibmlongdouble. Remove case OPT_mabi_ieeelongdouble. libgm2/ChangeLog: PR modula2/111956 * Makefile.am (TARGET_LONGDOUBLE_ABI): Remove. * Makefile.in: Regenerate. * libm2cor/Makefile.am (TARGET_LONGDOUBLE_ABI): Remove. * libm2cor/Makefile.in: Regenerate. * libm2iso/Makefile.am (TARGET_LONGDOUBLE_ABI): Remove. * libm2iso/Makefile.in: Regenerate. * libm2log/Makefile.am (TARGET_LONGDOUBLE_ABI): Remove. * libm2log/Makefile.in: Regenerate. * libm2min/Makefile.am (TARGET_LONGDOUBLE_ABI): Remove. * libm2min/Makefile.in: Regenerate. * libm2pim/Makefile.am (TARGET_LONGDOUBLE_ABI): Remove. * libm2pim/Makefile.in: Regenerate. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2024-01-03Update copyright years.Jakub Jelinek57-57/+57
2023-11-01PR modula2/102989: reimplement overflow detection in ztype though ↵Gaius Mulley6-33/+87
WIDE_INT_MAX_PRECISION The ZTYPE in iso modula2 is used to denote intemediate ordinal type const expressions and these are always converted into the approriate language or user ordinal type prior to code generation. The increase of bits supported by _BitInt causes the modula2 largeconst.mod regression failure tests to pass. The largeconst.mod test has been increased to fail, however the char at a time overflow check is now too slow to detect failure. The overflow detection for the ZTYPE has been rewritten to check against exceeding WIDE_INT_MAX_PRECISION (many orders of magnitude faster). gcc/m2/ChangeLog: PR modula2/102989 * gm2-compiler/SymbolTable.mod (OverflowZType): Import from m2expr. (ConstantStringExceedsZType): Remove import. (GetConstLitType): Replace ConstantStringExceedsZType with OverflowZType. * gm2-gcc/m2decl.cc (m2decl_ConstantStringExceedsZType): Remove. (m2decl_BuildConstLiteralNumber): Re-write. * gm2-gcc/m2decl.def (ConstantStringExceedsZType): Remove. * gm2-gcc/m2decl.h (m2decl_ConstantStringExceedsZType): Remove. * gm2-gcc/m2expr.cc (m2expr_StrToWideInt): Rewrite to check overflow. (m2expr_OverflowZType): New function. (ToWideInt): New function. * gm2-gcc/m2expr.def (OverflowZType): New procedure function declaration. * gm2-gcc/m2expr.h (m2expr_OverflowZType): New prototype. gcc/testsuite/ChangeLog: PR modula2/102989 * gm2/pim/fail/largeconst.mod: Updated foo to an outrageous value. * gm2/pim/fail/largeconst2.mod: Duplicate test removed. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2023-10-25PR modula2/111955 introduce isnan support to Builtins.defGaius Mulley1-0/+25
This patch introduces isnan, isnanf and isnanl to Builtins.def. It requires fallback functions isnan, isnanf, isnanl to be implemented in libgm2/libm2pim/wrapc.cc and gm2-libs-ch/wrapc.c. Access to the GCC builtin isnan tree is provided by adding an isnan definition and support functions to gm2-gcc/m2builtins.cc. gcc/m2/ChangeLog: PR modula2/111955 * gm2-gcc/m2builtins.cc (gm2_isnan_node): New tree. (DoBuiltinIsnan): New function. (m2builtins_BuiltInIsnan): New function. (m2builtins_init): Initialize gm2_isnan_node. (list_of_builtins): Add define for __builtin_isnan. * gm2-libs-ch/wrapc.c (wrapc_isnan): New function. (wrapc_isnanf): New function. (wrapc_isnanl): New function. * gm2-libs/Builtins.def (isnanf): New procedure function. (isnan): New procedure function. (isnanl): New procedure function. * gm2-libs/Builtins.mod: * gm2-libs/wrapc.def (isnan): New function. (isnanf): New function. (isnanl): New function. libgm2/ChangeLog: PR modula2/111955 * libm2pim/wrapc.cc (isnan): Export new function. (isnanf): Export new function. (isnanl): Export new function. gcc/testsuite/ChangeLog: PR modula2/111955 * gm2/pimlib/run/pass/testnan.mod: New test. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2023-10-17PR modula2/111756: Re-building all-gcc after source changes fails to linkGaius Mulley1-5/+14
When having modula-2 enabled in a development tree and there are any changes that trigger rebuilds in m2/ doing a 'make all-gcc' in the build directory might fail due to lack of dependency tracking. This patch introduces build dependencies into gcc/m2/Make-lang.in using -M* options. The patch also introduces all -M* options to cc1gm2 and gm2. gcc/m2/ChangeLog: PR modula2/111756 * Make-lang.in (CM2DEP): New define conditionally set if ($(CXXDEPMODE),depmode=gcc3). (GM2_1): Use $(CM2DEP). (m2/gm2-gcc/%.o): Ensure $(@D)/$(DEPDIR) is created. Add $(CM2DEP) to the $(COMPILER) command and use $(POSTCOMPILE). (m2/gm2-gcc/m2configure.o): Ditto. (m2/gm2-lang.o): Ditto. (m2/m2pp.o): Ditto. (m2/gm2-gcc/rtegraph.o): Ditto. (m2/mc-boot/$(SRC_PREFIX)%.o): Ditto. (m2/mc-boot-ch/$(SRC_PREFIX)%.o): Ditto. (m2/mc-boot-ch/$(SRC_PREFIX)%.o): Ditto. (m2/mc-boot/main.o): Ditto. (mcflex.o): Ditto. (m2/gm2-libs-boot/M2RTS.o): Ditto. (m2/gm2-libs-boot/%.o): Ditto. (m2/gm2-libs-boot/%.o): Ditto. (m2/gm2-libs-boot/RTcodummy.o): Ditto. (m2/gm2-libs-boot/RTintdummy.o): Ditto. (m2/gm2-libs-boot/wrapc.o): Ditto. (m2/gm2-libs-boot/UnixArgs.o): Ditto. (m2/gm2-libs-boot/choosetemp.o): Ditto. (m2/gm2-libs-boot/errno.o): Ditto. (m2/gm2-libs-boot/dtoa.o): Ditto. (m2/gm2-libs-boot/ldtoa.o): Ditto. (m2/gm2-libs-boot/termios.o): Ditto. (m2/gm2-libs-boot/SysExceptions.o): Ditto. (m2/gm2-libs-boot/SysStorage.o): Ditto. (m2/gm2-compiler-boot/M2GCCDeclare.o): Ditto. (m2/gm2-compiler-boot/M2Error.o): Ditto. (m2/gm2-compiler-boot/%.o): Ditto. (m2/gm2-compiler-boot/%.o): Ditto. (m2/gm2-compiler-boot/m2flex.o): Ditto. (m2/gm2-compiler/%.o): Ditto. (m2/gm2-compiler/m2flex.o): Ditto. (m2/gm2-libs-iso/%.o): Ditto. (m2/gm2-libs/%.o): Ditto. (m2/gm2-libs/%.o): Ditto. (m2/gm2-libs/choosetemp.o): Ditto. (m2/boot-bin/mklink$(exeext)): Ditto. (m2/pge-boot/%.o): Ditto. (m2/pge-boot/%.o): Ditto. (m2/gm2-compiler/%.o): Ensure $(@D)/$(DEPDIR) is created and use $(POSTCOMPILE). (m2/gm2-compiler/%.o): Ditto. (m2/gm2-libs-iso/%.o): Ditto. (m2/gm2-libs/%.o): Ditto. * README: Purge out of date info. * gm2-compiler/M2Comp.mod (MakeSaveTempsFileNameExt): Import. (OnExitDelete): Import. (GetModuleDefImportStatementList): Import. (GetModuleModImportStatementList): Import. (GetImportModule): Import. (IsImportStatement): Import. (IsImport): Import. (GetImportStatementList): Import. (File): Import. (Close): Import. (EOF): Import. (IsNoError): Import. (WriteLine): Import. (WriteChar): Import. (FlushOutErr): Import. (WriteS): Import. (OpenToRead): Import. (OpenToWrite): Import. (ReadS): Import. (WriteS): Import. (GetM): Import. (GetMM): Import. (GetDepTarget): Import. (GetMF): Import. (GetMP): Import. (GetObj): Import. (GetMD): Import. (GetMMD): Import. (GenerateDefDependency): New procedure. (GenerateDependenciesFromImport): New procedure. (GenerateDependenciesFromList): New procedure. (GenerateDependencies): New procedure. (Compile): Re-write. (compile): Re-format. (CreateFileStem): New procedure function. (DoPass0): Re-write. (IsLibrary): New procedure function. (IsUnique): New procedure function. (Append): New procedure. (MergeDep): New procedure. (GetRuleTarget): New procedure function. (ReadDepContents): New procedure function. (WriteDep): New procedure. (WritePhonyDep): New procedure. (WriteDepContents): New procedure. (CreateDepFilename): New procedure function. (Pass0CheckDef): New procedure function. (Pass0CheckMod): New procedure function. (DoPass0): Re-write. (DepContent): New variable. (DepOutput): New variable. (BaseName): New procedure function. * gm2-compiler/M2GCCDeclare.mod (PrintTerse): Handle IsImport. Replace IsGnuAsmVolatile with IsGnuAsm. * gm2-compiler/M2Options.def (EXPORT QUALIFIED): Remove list. (SetM): New procedure. (GetM): New procedure function. (SetMM): New procedure. (GetMM): New procedure function. (SetMF): New procedure. (GetMF): New procedure function. (SetPPOnly): New procedure. (GetB): New procedure function. (SetMD): New procedure. (GetMD): New procedure function. (SetMMD): New procedure. (GetMMD): New procedure function. (SetMQ): New procedure. (SetMT): New procedure. (GetMT): New procedure function. (GetDepTarget): New procedure function. (SetMP): New procedure. (GetMP): New procedure function. (SetObj): New procedure. (SetSaveTempsDir): New procedure. * gm2-compiler/M2Options.mod (SetM): New procedure. (GetM): New procedure function. (SetMM): New procedure. (GetMM): New procedure function. (SetMF): New procedure. (GetMF): New procedure function. (SetPPOnly): New procedure. (GetB): New procedure function. (SetMD): New procedure. (GetMD): New procedure function. (SetMMD): New procedure. (GetMMD): New procedure function. (SetMQ): New procedure. (SetMT): New procedure. (GetMT): New procedure function. (GetDepTarget): New procedure function. (SetMP): New procedure. (GetMP): New procedure function. (SetObj): New procedure. (SetSaveTempsDir): New procedure. * gm2-compiler/M2Preprocess.def (PreprocessModule): New parameters topSource and outputDep. Re-write. (MakeSaveTempsFileNameExt): New procedure function. (OnExitDelete): New procedure function. * gm2-compiler/M2Preprocess.mod (GetM): Import. (GetMM): Import. (OnExitDelete): Add debugging message. (RemoveFile): Add debugging message. (BaseName): Remove. (BuildCommandLineExecute): New procedure function. * gm2-compiler/M2Search.def (SetDefExtension): Remove unnecessary spacing. * gm2-compiler/SymbolTable.mod (GetSymName): Handle ImportSym and ImportStatementSym. * gm2-gcc/m2options.h (M2Options_SetMD): New function. (M2Options_GetMD): New function. (M2Options_SetMMD): New function. (M2Options_GetMMD): New function. (M2Options_SetM): New function. (M2Options_GetM): New function. (M2Options_SetMM): New function. (M2Options_GetMM): New function. (M2Options_GetMQ): New function. (M2Options_SetMF): New function. (M2Options_GetMF): New function. (M2Options_SetMT): New function. (M2Options_SetMP): New function. (M2Options_GetMP): New function. (M2Options_GetDepTarget): New function. * gm2-lang.cc (gm2_langhook_init): Correct comment case. (gm2_langhook_init_options): Add case OPT_M and OPT_MM. (gm2_langhook_post_options): Add case OPT_MF, OPT_MT, OPT_MD and OPT_MMD. * lang-specs.h (M2CPP): Pass though MF option. (MDMMD): New define. Add MDMMD to "@modula-2". Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2023-10-11PR modula2/111675 Incorrect packed record field value passed to a procedureGaius Mulley4-30/+16
This patch allows a packed field to be extracted and passed to a procedure. It ensures that the subrange type is the same for both the procedure and record field. It also extends the <* bytealignment (0) *> to cover packed subrange types. gcc/m2/ChangeLog: PR modula2/111675 * gm2-compiler/M2CaseList.mod (appendTree): Replace InitStringCharStar with InitString. * gm2-compiler/M2GCCDeclare.mod: Import AreConstantsEqual. (DeclareSubrange): Add zero alignment test and call BuildSmallestTypeRange if necessary. (WalkSubrangeDependants): Walk the align expression. (IsSubrangeDependants): Test the align expression. * gm2-compiler/M2Quads.mod (BuildStringAdrParam): Correct end name. * gm2-compiler/P2SymBuild.mod (BuildTypeAlignment): Allow subranges to be zero aligned (packed). * gm2-compiler/SymbolTable.mod (Subrange): Add Align field. (MakeSubrange): Set Align to NulSym. (PutAlignment): Assign Subrange.Align to align. (GetAlignment): Return Subrange.Align. * gm2-gcc/m2expr.cc (noBitsRequired): Rewrite. (calcNbits): Rename ... (m2expr_calcNbits): ... to this and test for negative values. (m2expr_BuildTBitSize): Replace calcNBits with m2expr_calcNbits. * gm2-gcc/m2expr.def (calcNbits): Export. * gm2-gcc/m2expr.h (m2expr_calcNbits): New prototype. * gm2-gcc/m2type.cc (noBitsRequired): Remove. (m2type_BuildSmallestTypeRange): Call m2expr_calcNbits. (m2type_BuildSubrangeType): Create range_type from build_range_type (type, lowval, highval). gcc/testsuite/ChangeLog: PR modula2/111675 * gm2/extensions/run/pass/packedrecord3.mod: New test. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2023-09-19PR 108143/modula2 LONGREAL and powerpc64le-linuxGaius Mulley15-200/+438
This patch introduces a configure for LONGREAL as float128 when targetting or hosting cc1gm2 on ppc64le. It fixes calls to builtins and fixes the -fdebug-builtins option. gcc/ChangeLog: * doc/gm2.texi (fdebug-builtins): Correct description. gcc/m2/ChangeLog: * Make-lang.in (host_mc_longreal): Detect hosting on powerpc64le and if so use __float128 for longreal in mc. (MC_ARGS): Append host_mc_longreal. * config-make.in (TEST_TARGET_CPU_DEFAULT): New variable. (TEST_HOST_CPU_DEFAULT): New variable. * configure: Regenerate. * configure.ac (M2C_LONGREAL_FLOAT128): New define set if target is powerpc64le. (M2C_LONGREAL_PPC64LE): New define set if target is powerpc64le. * gm2-compiler/M2GCCDeclare.mod: Correct comment case. * gm2-compiler/M2GenGCC.mod (MaybeDebugBuiltinAlloca): Call SetLastFunction for the builtin function call. (MaybeDebugBuiltinMemcpy): Call SetLastFunction for the builtin function call. (MaybeDebugBuiltinMemset): New procedure function. (MakeCopyUse): Use GNU formatting. (UseBuiltin): Rewrite to check BuiltinExists. (CodeDirectCall): Rewrite to check BuiltinExists and call SetLastFunction. (CodeMakeAdr): Re-format. * gm2-compiler/M2Options.def (SetDebugBuiltins): New procedure. * gm2-compiler/M2Options.mod (SetUninitVariableChecking): Allow "cond" to switch UninitVariableConditionalChecking separately. (SetDebugBuiltins): New procedure. * gm2-compiler/M2Quads.def (BuildFunctionCall): Add parameter ConstExpr. * gm2-compiler/M2Quads.mod (BuildRealProcedureCall): Add parameter to BuildRealFuncProcCall. (BuildRealFuncProcCall): Add ConstExpr parameter. Pass ConstExpr to BuildFunctionCall. (BuildFunctionCall): Add parameter ConstExpr. Pass ConstExpr to BuildRealFunctionCall. (BuildConstFunctionCall): Add parameter ConstExpr. Pass ConstExpr to BuildFunctionCall. (BuildRealFunctionCall): Add parameter ConstExpr. Pass ConstExpr to BuildRealFuncProcCall. * gm2-compiler/P3Build.bnf (SetOrDesignatorOrFunction): Pass FALSE to BuildFunctionCall. (AssignmentOrProcedureCall): Pass FALSE to BuildFunctionCall. * gm2-compiler/SymbolTable.def (IsProcedureBuiltinAvailable): New procedure function. * gm2-compiler/SymbolTable.mod (CanUseBuiltin): New procedure function. (IsProcedureBuiltinAvailable): New procedure function. * gm2-gcc/m2builtins.cc (DEBUGGING): Undef. (bf_category): New enum type. (struct builtin_function_entry): New field function_avail. (m2builtins_BuiltInMemCopy): Rename from ... (m2builtins_BuiltinMemCopy): ... this. (DoBuiltinMemSet): New function. (m2builtins_BuiltinMemSet): New function. (do_target_support_exists): New function. (target_support_exists): New function. (m2builtins_BuiltinExists): Return true or false. (m2builtins_BuildBuiltinTree): Rename local variables. Replace long_double_type_node with GetM2LongRealType. (m2builtins_init): Use GetM2LongRealType rather than long_double_type_node. * gm2-gcc/m2builtins.def (BuiltInMemCopy): Rename to ... (BuiltinMemCopy): ... this. (BuiltinMemSet): New procedure function. * gm2-gcc/m2builtins.h (m2builtins_BuiltInMemCopy): Rename to ... (m2builtins_BuiltinMemCopy): ... this. (m2builtins_BuiltinMemSet): New procedure function. * gm2-gcc/m2configure.cc (m2configure_M2CLongRealFloat128): New procedure function. (m2configure_M2CLongRealIBM128): New procedure function. (m2configure_M2CLongRealLongDouble): New procedure function. (m2configure_M2CLongRealLongDoublePPC64LE): New procedure function. * gm2-gcc/m2configure.def (M2CLongRealFloat128): New procedure function. (M2CLongRealIBM128): New procedure function. (M2CLongRealLongDouble): New procedure function. (M2CLongRealLongDoublePPC64LE): New procedure function. * gm2-gcc/m2configure.h (m2configure_FullPathCPP): New procedure function. (m2configure_M2CLongRealFloat128): New procedure function. (m2configure_M2CLongRealIBM128): New procedure function. (m2configure_M2CLongRealLongDouble): New procedure function. (m2configure_M2CLongRealLongDoublePPC64LE): New procedure function. * gm2-gcc/m2convert.cc (m2convert_BuildConvert): Use convert_loc. * gm2-gcc/m2options.h (M2Options_SetDebugBuiltins): New function. * gm2-gcc/m2statement.cc (m2statement_BuildAssignmentTree): Set TREE_USED to true. (m2statement_BuildGoto):Set TREE_USED to true. (m2statement_BuildParam): Set TREE_USED to true. (m2statement_BuildBuiltinCallTree): New function. (m2statement_BuildFunctValue): Set TREE_USED to true. * gm2-gcc/m2statement.def (BuildBuiltinCallTree): New procedure function. * gm2-gcc/m2statement.h (m2statement_BuildBuiltinCallTree): New procedure function. * gm2-gcc/m2treelib.cc (m2treelib_DoCall0): Remove spacing. (m2treelib_DoCall1): Remove spacing. (m2treelib_DoCall2): Remove spacing. (m2treelib_DoCall3): Remove spacing. (add_stmt): Rename parameter. * gm2-gcc/m2type.cc (build_set_type): Remove spacing. (build_m2_specific_size_type): Remove spacing. (finish_build_pointer_type): Remove spacing. (m2type_BuildVariableArrayAndDeclare): Remove spacing. (build_m2_short_real_node): Remove spacing. (build_m2_real_node): Remove spacing. (build_m2_long_real_node): Use float128_type_node if M2CLongRealFloat128 is set. (build_m2_ztype_node): Remove spacing. (build_m2_long_int_node): Remove spacing. (build_m2_long_card_node): Remove spacing. (build_m2_short_int_node): Remove spacing. (build_m2_short_card_node): Remove spacing. (build_m2_iso_loc_node): Remove spacing. (m2type_SameRealType): New function. (m2type_InitBaseTypes): Create m2_c_type_node using m2_long_complex_type_node. (m2type_SetAlignment): Tidy up comment. * gm2-gcc/m2type.def (SameRealType): New procedure function. * gm2-gcc/m2type.h (m2type_SameRealType): New procedure function. * gm2-lang.cc (gm2_langhook_type_for_mode): Build long complex node from m2 language specific long double node. * gm2-libs-log/RealConversions.mod (IsNan): New procedure function. (doPowerOfTen): Re-implement. * gm2-libs/Builtins.mod: Add newline. * gm2-libs/DynamicStrings.def (ReplaceChar): New procedure function. * gm2-libs/DynamicStrings.mod (ReplaceChar): New procedure function. * gm2config.aci.in (M2C_LONGREAL_FLOAT128): New config value. (M2C_LONGREAL_PPC64LE): New config value. * gm2spec.cc (lang_specific_driver): New local variable need_default_mabi set to default value depending upon M2C_LONGREAL_PPC64LE and M2C_LONGREAL_FLOAT128. * lang.opt (Wcase-enum): Moved to correct section. * m2pp.cc (m2pp_real_type): New function. (m2pp_type): Call m2pp_real_type. (m2pp_print_mode): New function. (m2pp_simple_type): Call m2pp_simple_type. (m2pp_float): New function. (m2pp_expression): Call m2pp_float. * mc-boot/GDynamicStrings.cc: Rebuild. * mc-boot/GDynamicStrings.h: Rebuild. * mc-boot/GFIO.cc: Rebuild. * mc-boot/GFIO.h: Rebuild. * mc-boot/GIO.cc: Rebuild. * mc-boot/GRTint.cc: Rebuild. * mc-boot/Gdecl.cc: Rebuild. * mc-boot/GmcOptions.cc: Rebuild. * mc-boot/GmcOptions.h: Rebuild. * mc/decl.mod: Rebuild. * mc/mcOptions.def (getCRealType): New procedure function. (getCLongRealType): New procedure function. (getCShortRealType): New procedure function. * mc/mcOptions.mod (getCRealType): New procedure function. (getCLongRealType): New procedure function. (getCShortRealType): New procedure function. libgm2/ChangeLog: * Makefile.am (TARGET_LONGDOUBLE_ABI): New variable set to -mabi=ieeelongdouble if the target is powerpc64le. (AM_MAKEFLAGS): Append TARGET_LONGDOUBLE_ABI. * Makefile.in: Rebuild. * libm2cor/Makefile.am (AM_MAKEFLAGS): Add CFLAGS_LONGDOUBLE and TARGET_LONGDOUBLE_ABI. (libm2cor_la_CFLAGS): Add TARGET_LONGDOUBLE_ABI. (libm2cor_la_M2FLAGS): Add TARGET_LONGDOUBLE_ABI. * libm2cor/Makefile.in: Rebuild. * libm2iso/Makefile.am (AM_MAKEFLAGS): Add CFLAGS_LONGDOUBLE and TARGET_LONGDOUBLE_ABI. (libm2iso_la_CFLAGS): Add TARGET_LONGDOUBLE_ABI. (libm2iso_la_M2FLAGS): Add TARGET_LONGDOUBLE_ABI. * libm2iso/Makefile.in: Rebuild. * libm2log/Makefile.am (AM_MAKEFLAGS): Add CFLAGS_LONGDOUBLE and TARGET_LONGDOUBLE_ABI. (libm2log_la_CFLAGS): Add TARGET_LONGDOUBLE_ABI. (libm2log_la_M2FLAGS): Add TARGET_LONGDOUBLE_ABI. * libm2log/Makefile.in: Rebuild. * libm2min/Makefile.am (AM_MAKEFLAGS): Add CFLAGS_LONGDOUBLE and TARGET_LONGDOUBLE_ABI. (libm2min_la_CFLAGS): Add TARGET_LONGDOUBLE_ABI. (libm2min_la_M2FLAGS): Add TARGET_LONGDOUBLE_ABI. * libm2min/Makefile.in: Rebuild. * libm2pim/Makefile.am (AM_MAKEFLAGS): Add CFLAGS_LONGDOUBLE and TARGET_LONGDOUBLE_ABI. (libm2pim_la_CFLAGS): Add TARGET_LONGDOUBLE_ABI. (libm2pim_la_M2FLAGS): Add TARGET_LONGDOUBLE_ABI. * libm2pim/Makefile.in: Rebuild. gcc/testsuite/ChangeLog: * gm2/extensions/pass/libc.def: Add spacing. * gm2/pimlib/logitech/run/pass/realconv.mod: Add debugging print. * gm2/switches/uninit-variable-checking/cascade/fail/switches-uninit-variable-checking-cascade-fail.exp: Add -fdebug-builtins flag. * lib/gm2.exp (gm2_target_compile_default): Add -mabi=ieeelongdouble if the target is powerpc. (gm2_link_flags): Add -mabi=ieeelongdouble if the target is powerpc. * gm2/pim/intrinsic/run/pass/cstub.c: New test. * gm2/pim/intrinsic/run/pass/cstub.def: New test. * gm2/pim/intrinsic/run/pass/pim-intrinsic-run-pass.exp: New test. * gm2/pim/intrinsic/run/pass/test.mod: New test. * gm2/pim/run/pass/builtins.mod: New test. * gm2/pim/run/pass/convert1.mod: New test. * gm2/pim/run/pass/longint1.mod: New test. * gm2/pim/run/pass/longint2.mod: New test. * gm2/pim/run/pass/longint3.mod: New test. * gm2/pim/run/pass/longint4.mod: New test. * gm2/pim/run/pass/longint5.mod: New test. * gm2/pim/run/pass/longint6.mod: New test. * gm2/pim/run/pass/longint7.mod: New test. * gm2/pim/run/pass/longint8.mod: New test. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2023-09-14modula2: introduce case checking when switching on subrangesGaius Mulley3-1/+37
This patch extends the -Wcase-enum warning to catch missing elements from subranges. The patch also includes removal of unused parameters from M2SymInit.mod and M2CaseList.mod. gcc/m2/ChangeLog: * gm2-compiler/M2CaseList.mod (appendString): New procedure. (appendEnum): Re-implement. (NoOfSetElements): New procedure function. (isPrintableChar): New procedure function. (appendTree): New procedure. (SubrangeErrors): New procedure. (EmitMissingRangeErrors): Call SubrangeErrors if appropriate. * gm2-compiler/M2SymInit.mod (SetFieldInitializedNo): Avoid using a temporary variable once. (IsLocalVar): Comment out. (RecordContainsVarient): Remove fieldtype. (GenerateNoteFlow): Remove lst parameter. (CheckDeferredRecordAccess): Remove lst parameter. (CheckUnary): Remove lst parameter. Remove procSym. (CheckBinary): Remove lst parameter. Remove procSym. (CheckIndrX): Remove lst parameter. Remove procSym. (CheckXIndr): Remove bblst and procSym parameters. (CheckRecordField): Remove procSym, op1tok, op2tok and op2. (CheckBecomes): Remove procSym and bblst. (CheckComparison): Remove procSym and bblst. (CheckAddr): Remove procSym parameter. * gm2-gcc/m2expr.cc (m2expr_CSTIntToString): New function. (m2expr_CSTIntToChar): New function. * gm2-gcc/m2expr.def (CSTIntToString): New procedure function declaration. (CSTIntToChar): New procedure function declaration. * gm2-gcc/m2expr.h (m2expr_CSTIntToChar): New prototype. (m2expr_CSTIntToString): New prototype. gcc/testsuite/ChangeLog: * gm2/switches/case/fail/subrangecase.mod: New test. * gm2/switches/case/fail/subrangecase2.mod: New test. * gm2/switches/case/fail/subrangecase3.mod: New test. * gm2/switches/case/fail/subrangecase4.mod: New test. * gm2/switches/case/fail/subrangecase5.mod: New test. * gm2/switches/case/fail/subrangecase6.mod: New test. * gm2/switches/case/pass/subrangecase.mod: New test. * gm2/switches/case/pass/subrangecase2.mod: New test. * gm2/switches/case/pass/subrangecase3.mod: New test. * gm2/switches/case/pass/subrangecase4.mod: New test. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2023-09-12modula2: new option -Wcase-enum and associated fixesGaius Mulley1-1/+1
This patch introduces -Wcase-enum which enumerates each missing field in a case statement without an else clause providing the selector expression type is an enum. gcc/ChangeLog: * doc/gm2.texi (Compiler options): Document new option -Wcase-enum. gcc/m2/ChangeLog: * gm2-compiler/M2CaseList.def (PushCase): Rename parameters r to rec and v to va. Add expr parameter. (MissingCaseStatementBounds): New procedure function. * gm2-compiler/M2CaseList.mod (RangePair): Add expression. (PushCase): Rename parameters r to rec and v to va. Add expr parameter. (RemoveRange): New procedure function. (SubBitRange): Detect the case when the range in the set matches lo..hi. (CheckLowHigh): New procedure. (ExcludeCaseRanges): Rename parameter c to cd. Rename local variables q to cl and r to rp. (High): Remove. (Low): Remove. (DoEnumValues): Remove. (IncludeElement): New procedure. (IncludeElements): New procedure. (ErrorRangeEnum): New procedure. (ErrorRange): Remove. (ErrorRanges): Remove. (appendEnum): New procedure. (appendStr): New procedure. (EnumerateErrors): New procedure. (MissingCaseBounds): Re-implement. (InRangeList): Remove. (MissingCaseStatementBounds): New procedure function. (checkTypes): Re-format. (inRange): Re-format. (TypeCaseBounds): Re-format. * gm2-compiler/M2Error.mod (GetAnnounceScope): Add noscope to case label list. * gm2-compiler/M2GCCDeclare.mod: Replace ForeachFieldEnumerationDo with ForeachLocalSymDo. * gm2-compiler/M2Options.def (SetCaseEnumChecking): New procedure. (CaseEnumChecking): New variable. * gm2-compiler/M2Options.mod (SetCaseEnumChecking): New procedure. (Module initialization): set CaseEnumChecking to FALSE. * gm2-compiler/M2Quads.def (QuadOperator): Alphabetically ordered. * gm2-compiler/M2Quads.mod (IsBackReferenceConditional): Add else clause. (BuildCaseStart): Pass selector expression to InitCaseBounds. (CheckUninitializedVariablesAreUsed): Remove. (IsInlineWithinBlock): Remove. (AsmStatementsInBlock): Remove. (CheckVariablesInBlock): Remove commented code. (BeginVarient): Pass NulSym to InitCaseBounds. * gm2-compiler/M2Range.mod (FoldCaseBounds): New local variable errorGenerated. Add call to MissingCaseStatementBounds. * gm2-compiler/P3Build.bnf (CaseEndStatement): Call ElseCase. * gm2-compiler/PCSymBuild.mod (InitDesExpr): Add else clause. (InitFunction): Add else clause. (InitConvert): Add else clause. (InitLeaf): Add else clause. (InitBinary): Add else clause. (InitUnary): Add else clause. * gm2-compiler/SymbolTable.def (GetNth): Re-write comment. (ForeachFieldEnumerationDo): Re-write comment stating alphabetical traversal. * gm2-compiler/SymbolTable.mod (GetNth): Re-write comment. Add case label for EnumerationSym and call GetItemFromList. (ForeachFieldEnumerationDo): Re-write comment stating alphabetical traversal. (SymEnumeration): Add ListOfFields used for declaration order. (MakeEnumeration): Initialize ListOfFields. (PutFieldEnumeration): Include Field in ListOfFields. * gm2-gcc/m2options.h (M2Options_SetCaseEnumChecking): New function. * gm2-lang.cc (gm2_langhook_handle_option): Add OPT_Wcase_enum case and call M2Options_SetCaseEnumChecking. * lang.opt (Wcase-enum): Add. gcc/testsuite/ChangeLog: * gm2/switches/case/fail/missingclause.mod: New test. * gm2/switches/case/fail/switches-case-fail.exp: New test. * gm2/switches/case/pass/enumcase.mod: New test. * gm2/switches/case/pass/enumcase2.mod: New test. * gm2/switches/case/pass/switches-case-pass.exp: New test. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2023-07-11[modula2] Improve uninitialized variable analysis by combining basic blocksGaius Mulley2-1/+3
This patch combines basic blocks for static analysis of uninitialized variables providing that they are not the top of a loop, are not reached by a conditional and are not reached after a procedure call. It also avoids checking array accesses for static analysis. Finally the patch adds switch modifiers to allow static analysis to include conditional branches for subsequent basic block analysis. gcc/ChangeLog: * doc/gm2.texi (-Wuninit-variable-checking=) New item. gcc/m2/ChangeLog: * gm2-compiler/M2BasicBlock.def (InitBasicBlocksFromRange): New parameter ScopeSym. * gm2-compiler/M2BasicBlock.mod (ConvertQuads2BasicBlock): New parameter ScopeSym. (InitBasicBlocksFromRange): New parameter ScopeSym. Call ConvertQuads2BasicBlock with ScopeSym. (DisplayBasicBlocks): Uncomment. * gm2-compiler/M2Code.mod: Replace VariableAnalysis with ScopeBlockVariableAnalysis. (InitialDeclareAndOptiomize): Add parameter scope. (SecondDeclareAndOptimize): Add parameter scope. * gm2-compiler/M2GCCDeclare.mod (DeclareConstructor): Add scope parameter to DeclareTypesConstantsProceduresInRange. (DeclareTypesConstantsProceduresInRange): New parameter scope. Pass scope to DisplayQuadRange. Reformatted. * gm2-compiler/M2GenGCC.def (ConvertQuadsToTree): New parameter scope. * gm2-compiler/M2GenGCC.mod (ConvertQuadsToTree): New parameter scope. * gm2-compiler/M2Optimize.mod (KnownReachable): New parameter scope. * gm2-compiler/M2Options.def (SetUninitVariableChecking): Add arg parameter. * gm2-compiler/M2Options.mod (SetUninitVariableChecking): Add arg parameter and set boolean UninitVariableChecking and UninitVariableConditionalChecking. (UninitVariableConditionalChecking): New boolean set to FALSE. * gm2-compiler/M2Quads.def (IsGoto): New procedure function. (DisplayQuadRange): Add scope parameter. (LoopAnalysis): Add scope parameter. * gm2-compiler/M2Quads.mod: Import PutVarArrayRef. (IsGoto): New procedure function. (LoopAnalysis): Add scope parameter and use MetaErrorT1 instead of WarnStringAt. (BuildStaticArray): Call PutVarArrayRef. (BuildDynamicArray): Call PutVarArrayRef. (DisplayQuadRange): Add scope parameter. (GetM2OperatorDesc): Add relational condition cases. * gm2-compiler/M2Scope.def (ScopeProcedure): Add parameter. * gm2-compiler/M2Scope.mod (DisplayScope): Pass scopeSym to DisplayQuadRange. (ForeachScopeBlockDo): Pass scopeSym to p. * gm2-compiler/M2SymInit.def (VariableAnalysis): Rename to ... (ScopeBlockVariableAnalysis): ... this. * gm2-compiler/M2SymInit.mod (ScopeBlockVariableAnalysis): Add scope parameter. (bbEntry): New pointer to record. (bbArray): New array. (bbFreeList): New variable. (errorList): New list. (IssueConditional): New procedure. (GenerateNoteFlow): New procedure. (IssueWarning): New procedure. (IsUniqueWarning): New procedure. (CheckDeferredRecordAccess): Re-implement. (CheckBinary): Add warning and lst parameters. (CheckUnary): Add warning and lst parameters. (CheckXIndr): Add warning and lst parameters. (CheckIndrX): Add warning and lst parameters. (CheckBecomes): Add warning and lst parameters. (CheckComparison): Add warning and lst parameters. (CheckReadBeforeInitQuad): Add warning and lst parameters to all Check procedures. Add all case quadruple clauses. (FilterCheckReadBeforeInitQuad): Add warning and lst parameters. (CheckReadBeforeInitFirstBasicBlock): Add warning and lst parameters. (bbArrayKill): New procedure. (DumpBBEntry): New procedure. (DumpBBArray): New procedure. (DumpBBSequence): New procedure. (TestBBSequence): New procedure. (CreateBBPermultations): New procedure. (ScopeBlockVariableAnalysis): New procedure. (GetOp3): New procedure. (GenerateCFG): New procedure. (NewEntry): New procedure. (AppendEntry): New procedure. (init): Initialize bbFreeList and errorList. * gm2-compiler/SymbolTable.def (PutVarArrayRef): New procedure. (IsVarArrayRef): New procedure function. * gm2-compiler/SymbolTable.mod (SymVar): ArrayRef new field. (MakeVar): Set ArrayRef to FALSE. (PutVarArrayRef): New procedure. (IsVarArrayRef): New procedure function. * gm2-gcc/init.cc (_M2_M2SymInit_init): New prototype. (init_PerCompilationInit): Add call to _M2_M2SymInit_init. * gm2-gcc/m2options.h (M2Options_SetUninitVariableChecking): New definition. * gm2-lang.cc (gm2_langhook_handle_option): Add new case OPT_Wuninit_variable_checking_. * lang.opt: Wuninit-variable-checking= new entry. gcc/testsuite/ChangeLog: * gm2/switches/uninit-variable-checking/cascade/fail/cascadedif.mod: New test. * gm2/switches/uninit-variable-checking/cascade/fail/switches-uninit-variable-checking-cascade-fail.exp: New test. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2023-07-03PR modula2/110125 variables reported as uninitialized when set inside WITHGaius Mulley1-0/+2
The modula-2 static analysis incorrectly identifies variables as uninitialized if they are initialized within a WITH statement. This bug fix re-implements the variable static analysis and will detect simple pointer record fields being accessed before being initialized. The static analysis is limited to the first basic block in a procedure. It does not check variant records, arrays or sets. A new option -Wuninit-variable-checking will turn on the new semantic checking (-Wall also enables the new checking). gcc/ChangeLog: PR modula2/110125 * doc/gm2.texi (Semantic checking): Include examples using -Wuninit-variable-checking. gcc/m2/ChangeLog: PR modula2/110125 * Make-lang.in (GM2-COMP-BOOT-DEFS): Add M2SymInit.def. (GM2-COMP-BOOT-MODS): Add M2SymInit.mod. * gm2-compiler/M2BasicBlock.mod: Formatting changes. * gm2-compiler/M2Code.mod: Remove import of VariableAnalysis from M2Quads. Import VariableAnalysis from M2SymInit.mod. * gm2-compiler/M2GCCDeclare.mod (PrintVerboseFromList): Add debugging print for a component. (TypeConstFullyDeclared): Call RememberType for every type. * gm2-compiler/M2GenGCC.mod (CodeReturnValue): Add parameter to GetQuadOtok. (CodeBecomes): Add parameter to GetQuadOtok. (CodeXIndr): Add parameter to GetQuadOtok. * gm2-compiler/M2Optimize.mod (ReduceBranch): Reformat and preserve operand token positions when reducing the branch quadruples. (ReduceGoto): Reformat. (FoldMultipleGoto): Reformat. (KnownReachable): Reformat. * gm2-compiler/M2Options.def (UninitVariableChecking): New variable declared and exported. (SetUninitVariableChecking): New procedure. * gm2-compiler/M2Options.mod (SetWall): Set UninitVariableChecking. (SetUninitVariableChecking): New procedure. * gm2-compiler/M2Quads.def (PutQuadOtok): Exported and declared. (VariableAnalysis): Removed. * gm2-compiler/M2Quads.mod (PutQuadOtok): New procedure. (doVal): Reformatted. (MarkAsWrite): Reformatted. (MarkArrayAsWritten): Reformatted. (doIndrX): Use PutQuadOtok. (MakeRightValue): Use GenQuadOtok. (MakeLeftValue): Use GenQuadOtok. (CheckReadBeforeInitialized): Remove. (IsNeverAltered): Reformat. (DebugLocation): New procedure. (BuildDesignatorPointer): Use GenQuadO to preserve operand token position. (BuildRelOp): Use GenQuadOtok ditto. * gm2-compiler/SymbolTable.def (VarCheckReadInit): New procedure. (VarInitState): New procedure. (PutVarInitialized): New procedure. (PutVarFieldInitialized): New procedure function. (GetVarFieldInitialized): New procedure function. (PrintInitialized): New procedure. * gm2-compiler/SymbolTable.mod (VarCheckReadInit): New procedure. (VarInitState): New procedure. (PutVarInitialized): New procedure. (PutVarFieldInitialized): New procedure function. (GetVarFieldInitialized): New procedure function. (PrintInitialized): New procedure. (LRInitDesc): New type. (SymVar): InitState new field. (MakeVar): Initialize InitState. * gm2-gcc/m2options.h (M2Options_SetUninitVariableChecking): New function declaration. * gm2-lang.cc (gm2_langhook_handle_option): Detect OPT_Wuninit_variable_checking and call SetUninitVariableChecking. * lang.opt: Add Wuninit-variable-checking. * gm2-compiler/M2SymInit.def: New file. * gm2-compiler/M2SymInit.mod: New file. gcc/testsuite/ChangeLog: PR modula2/110125 * gm2/switches/uninit-variable-checking/fail/testinit.mod: New test. * gm2/switches/uninit-variable-checking/fail/testlarge.mod: New test. * gm2/switches/uninit-variable-checking/fail/testlarge2.mod: New test. * gm2/switches/uninit-variable-checking/fail/testrecinit.mod: New test. * gm2/switches/uninit-variable-checking/fail/testrecinit2.mod: New test. * gm2/switches/uninit-variable-checking/fail/testrecinit5.mod: New test. * gm2/switches/uninit-variable-checking/fail/testsmallrec.mod: New test. * gm2/switches/uninit-variable-checking/fail/testsmallrec2.mod: New test. * gm2/switches/uninit-variable-checking/fail/testsmallvec.mod: New test. * gm2/switches/uninit-variable-checking/fail/testvarinit.mod: New test. * gm2/switches/uninit-variable-checking/fail/testwithnoptr.mod: New test. * gm2/switches/uninit-variable-checking/fail/testwithptr.mod: New test. * gm2/switches/uninit-variable-checking/fail/testwithptr2.mod: New test. * gm2/switches/uninit-variable-checking/fail/testwithptr3.mod: New test. * gm2/switches/uninit-variable-checking/pass/testrecinit3.mod: New test. * gm2/switches/uninit-variable-checking/pass/testrecinit5.mod: New test. * gm2/switches/uninit-variable-checking/pass/testsmallrec.mod: New test. * gm2/switches/uninit-variable-checking/pass/testsmallrec2.mod: New test. * gm2/switches/uninit-variable-checking/pass/testvarinit.mod: New test. * gm2/switches/uninit-variable-checking/pass/testwithptr.mod: New test. * gm2/switches/uninit-variable-checking/pass/testwithptr2.mod: New test. * gm2/switches/uninit-variable-checking/pass/testwithptr3.mod: New test. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2023-06-18PR modula2/110284 Remove stor-layout.o and backend header filesGaius Mulley1-4/+0
This patch removes stor-layout.o from the front end and also removes back end header files from gcc-consolidation.h. gcc/m2/ChangeLog: PR modula2/110284 * Make-lang.in (m2_OBJS): Assign $(GM2_C_OBJS). (GM2_C_OBJS): Remove m2/stor-layout.o. (m2/stor-layout.o): Remove rule. * gm2-gcc/gcc-consolidation.h (rtl.h): Remove include. (df.h): Remove include. (except.h): Remove include. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2023-05-18m2: use _P() defines from tree.hBernhard Reutner-Fischer6-17/+17
gcc/m2/ChangeLog: * gm2-gcc/m2builtins.cc (doradix): Use _P defines from tree.h. (doplaces): Ditto. (doexponentmin): Ditto. (doexponentmax): Ditto. (dolarge): Ditto. (dosmall): Ditto. (dogUnderflow): Ditto. * gm2-gcc/m2convert.cc (unsafe_conversion_p): Ditto. * gm2-gcc/m2expr.cc (m2expr_build_unary_op_check): Ditto. (m2expr_build_binary_op_check): Ditto. * gm2-gcc/m2tree.cc (m2tree_is_var): Ditto. * gm2-gcc/m2treelib.cc (build_modify_expr): Ditto. * gm2-gcc/m2type.cc (gm2_finish_decl): Ditto. * m2pp.cc (hextree): Ditto. (m2pp_call_expr): Ditto.
2023-04-26PR modula2/108121 Re-implement overflow detection for constant literalsGaius Mulley7-305/+148
This patch fixes the overflow detection for constant literals. The ZTYPE is changed to int128 (or int64) if int128 is unavailable and constant literals are built from widest_int. The widest_int is converted into the tree type and checked for overflow. m2expr_interpret_integer and append_m2_digit are removed. gcc/m2/ChangeLog: PR modula2/108121 * gm2-compiler/M2ALU.mod (Less): Reformatted. * gm2-compiler/SymbolTable.mod (DetermineSizeOfConstant): Remove from import. (ConstantStringExceedsZType): Import. (GetConstLitType): Re-implement using ConstantStringExceedsZType. * gm2-gcc/m2decl.cc (m2decl_DetermineSizeOfConstant): Remove. (m2decl_ConstantStringExceedsZType): New function. (m2decl_BuildConstLiteralNumber): Re-implement. * gm2-gcc/m2decl.def (DetermineSizeOfConstant): Remove. (ConstantStringExceedsZType): New function. * gm2-gcc/m2decl.h (m2decl_DetermineSizeOfConstant): Remove. (m2decl_ConstantStringExceedsZType): New function. * gm2-gcc/m2expr.cc (append_digit): Remove. (m2expr_interpret_integer): Remove. (append_m2_digit): Remove. (m2expr_StrToWideInt): New function. (m2expr_interpret_m2_integer): Remove. * gm2-gcc/m2expr.def (CheckConstStrZtypeRange): New function. * gm2-gcc/m2expr.h (m2expr_StrToWideInt): New function. * gm2-gcc/m2type.cc (build_m2_word64_type_node): New function. (build_m2_ztype_node): New function. (m2type_InitBaseTypes): Call build_m2_ztype_node. * gm2-lang.cc (gm2_type_for_size): Re-write using early returns. gcc/testsuite/ChangeLog: PR modula2/108121 * gm2/pim/fail/largeconst.mod: Increased constant value test to fail now that cc1gm2 uses widest_int to represent a ZTYPE. * gm2/pim/fail/largeconst2.mod: New test. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2023-04-21PR modula2/109586 cc1gm2 ICE when compiling large source files.Gaius Mulley1-2/+2
The function m2block_RememberConstant calls m2tree_IsAConstant. However IsAConstant does not recognise TREE_CODE(t) == CONSTRUCTOR as a constant. Without this patch CONSTRUCTOR contants are garbage collected (and not preserved) resulting in a corrupt tree and crash. gcc/m2/ChangeLog: PR modula2/109586 * gm2-gcc/m2tree.cc (m2tree_IsAConstant): Add (TREE_CODE (t) == CONSTRUCTOR) to expression. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2023-04-13PR modula2/109496 Fix constant char parameter passing to an array of charGaius Mulley3-0/+18
This patch fixes PR modula2/109496 and PR modula2/109497. The fix for PR modula2/109496 promotes a char constant to a string. The PR modula2/109497 allows for constant chars to be added to form a string. The fixes for both PR's occur in M2GenGCC.mod and M2GCCDeclare.mod after the resolving of constant declarations. gcc/m2/ChangeLog: * gm2-compiler/M2ALU.def (PopChar): New procedure function. * gm2-compiler/M2ALU.mod (PopChar): New procedure function. * gm2-compiler/M2GCCDeclare.mod (PromoteToString): Detect a single constant char and build a C string. * gm2-compiler/M2GenGCC.mod (IsConstStr): New procedure function. (GetStr): New procedure function. (FoldAdd): Use IsConstStr. * gm2-compiler/M2Quads.mod: Formatting changes. * gm2-gcc/m2expr.cc (m2expr_GetCstInteger): New function. * gm2-gcc/m2expr.def (GetCstInteger): New procedure function. * gm2-gcc/m2expr.h (m2expr_GetCstInteger): New prototype. gcc/testsuite/ChangeLog: PR modula2/109497 * gm2/pim/run/pass/addcharconst.mod: New test. PR modula2/109496 * gm2/pim/run/pass/singlechar.mod: New test. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2023-03-29PR modula2/109336 - The -fmod= and -fdef= options do not workGaius Mulley1-1/+1
The -fmod= and -fdef= options do not work. After the linking re-implementation and subsequent restructuring the -fmod= amd -fdef= are now broken. This patch adds -fmod= and -fdef= processing into gm2spec.cc. It also reduces the complexity of extension handling within M2Search by storing the preceeding "." in the extension. gcc/m2/ChangeLog: PR modula2/109336 PR modula2/109315 * gm2-compiler/M2FileName.mod (CalculateFileName): Simplified by ensuring the extension contains the ".". (CalculateStemName): Re-formatted. (ExtractExtension): Re-formatted. (ExtractModule): Re-formatted. * gm2-compiler/M2Options.def (setdefextension): Add block comment. (setmodextension): Add block comment. Re-formatted. * gm2-compiler/M2Options.mod (setdefextension): Add block comment. (setmodextension): Add block comment. Re-formatted. * gm2-compiler/M2Search.mod (FindSourceDefFile): Use DefaultDefExt. (DefaultDefExt): New constant. (DefaultModExt): New constant. (FindSourceModFile): Use DefaultModExt. * gm2-gcc/m2decl.cc (m2decl_DeclareKnownVariable): Correct spelling. * gm2spec.cc (M2SOURCE): New constant. (LANGSPEC): New value. (MATHLIB): New value. (WITHLIBC): New value. (SKIPOPT): New value. (lang_specific_driver): Replace seen_module_extension bool with module_extension char *. Detect -fmod= and remember extension. Use the extension to detect modula-2 source and mark it as such. gcc/testsuite/ChangeLog: PR modula2/109336 * gm2/link/nondefaultext/pass/hello.md: New test. * gm2/link/nondefaultext/pass/liba.dm: New test. * gm2/link/nondefaultext/pass/liba.md: New test. * gm2/link/nondefaultext/pass/link-nondefaultext-pass.exp: New test. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2023-03-23PR modula2/109264 Bugfix resolve opaque types containing setsGaius Mulley3-8/+3
Resolve opaque type handling. The bug is caused by the compiler attempting to resolve the meta types of a constant constructor. It incorrectly attempts to get the type on an enumeration type (resulting in NulSym) which causes the meta resolver to spin. Some PHBuild rules (building records need to be copied from P3Build so that hidden types are resolved in order across the compile. gcc/m2/ChangeLog: PR modula2/109264 * gm2-compiler/M2Quads.mod (BuildConstFunctionCall): Comment out ErrorString in debugging block. (BuildConstructorStart): Replace Assert with a call to MetaErrorT3. Import MetaErrorT3. * gm2-compiler/PCSymBuild.mod (buildConstFunction): Rename local variables. (WalkFunctionParam): Remove test for IsEnumeration when resolving MIN or MAX parameters. * gm2-compiler/PHBuild.bnf (BlockAssert): New procedure. (ErrorArrayat): New procedure. (Expect): Renamed parameter t to tok. (PushQualident): New rule. (ConstSetOrQualidentOrFunction): Force AutoOn. (TypeDeclaration): Add debugging assert. (SimpleType): Add debugging assert. (DefaultRecordAttributes): New rule (and bugfix). (FieldPragmaExpression): New rule (and bugfix). (PragmaConstExpression): New rule (and bugfix). (SetOrDesignatorOrFunction): Add debugging assert. (Block): Add debugging assert. * gm2-gcc/m2expr.cc (m2expr_ConstantExpressionWarning): int to bool. * gm2-gcc/m2expr.h (m2expr_TreeOverflow): int to bool. (m2expr_GetBooleanTrue): Remove. (m2expr_GetBooleanFalse): Remove. * gm2-gcc/m2options.h (M2Options_SetStatistics): Replace int with bool. gcc/testsuite/ChangeLog: PR modula2/109264 * gm2/iso/extended-opaque/pass/iso-extended-opaque-pass.exp: New test. * gm2/iso/extended-opaque/pass/stressset.def: New test. * gm2/iso/extended-opaque/pass/stressset.mod: New test. * gm2/iso/extended-opaque/pass/testset.mod: New test. * gm2/projects/iso/small/run/pass/iso-extended-opaque-run-pass.exp: New test. * gm2/projects/iso/small/run/pass/stressset.def: New test. * gm2/projects/iso/small/run/pass/stressset.mod: New test. * gm2/projects/iso/small/run/pass/test1.mod: New test. * gm2/projects/iso/small/run/pass/testlib.def: New test. * gm2/projects/iso/small/run/pass/testlib.mod: New test. * gm2/projects/iso/small/run/pass/testset.mod: New test. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2023-03-22PR modula2/107630 Remove M2LINK and remove some cross linkingGaius Mulley1-1/+2
Remove M2LINK.def. Pass the user forced module initialization string as a parameter to M2RTS.ConstructModules. This patch allows -fm2-whole-program to link successfully using dynamic libraries. gcc/m2/ChangeLog: PR modula2/107630 * Make-lang.in (m2/stage2/cc1gm2$(exeext)): Remove m2/gm2-libs-boot/M2LINK.o. (m2/stage1/cc1gm2$(exeext)): Ditto. (GM2-LIBS-BOOT-DEFS): Remove M2LINK.def. (GM2-LIBS-DEFS): Ditto. (m2/mc-boot/$(SRC_PREFIX)%.o): Replace CXX_FLAGS with CXXFLAGS. (m2/mc-boot-ch/$(SRC_PREFIX)%.o): Ditto. (m2/mc-boot/main.o): Ditto. (mcflex.o): Add $(CFLAGS). (m2/gm2-libs-boot/M2LINK.o): Remove rule. * gm2-compiler/M2GCCDeclare.def (DeclareM2linkGlobals): Remove. * gm2-compiler/M2GCCDeclare.mod: (M2LinkEntry): Remove. (M2LinkIndex): Remove. (DoVariableDeclaration): Remove initial and call to AddEntryM2Link. (AddEntryM2Link): Remove. (GetEntryM2Link): Remove. (DeclareM2linkGlobals): Remove. (DetectM2LinkInitial): Remove. (InitM2LinkModule): Remove. * gm2-compiler/M2GenGCC.mod (CodeFinallyEnd): Remove call to DeclareM2linkGlobals. * gm2-compiler/M2Quads.mod (BuildM2InitFunction): Add extra parameter containing runtime module override to ConstructModules. * gm2-compiler/M2Scaffold.mod: Update comment describing ConstructModules. * gm2-gcc/m2decl.cc (m2decl_DeclareM2linkForcedModuleInitOrder): Remove. * gm2-libs-iso/M2RTS.def (ConstructModules): Add overrideliborder parameter. * gm2-libs-iso/M2RTS.mod: Add overrideliborder parameter. * gm2-libs/M2Dependent.def (ConstructModules): Add overrideliborder parameter. * gm2-libs/M2Dependent.mod (ConstructModules): Add overrideliborder parameter. * gm2-libs/M2RTS.def (ConstructModules): Add overrideliborder parameter. * gm2-libs/M2RTS.mod (ConstructModules): Add overrideliborder parameter. * gm2-libs/M2LINK.def: Removed. libgm2/ChangeLog: * libm2pim/Makefile.am (M2DEFS): Remove M2LINK.def. * libm2pim/Makefile.in: Rebuild. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2023-03-19[modula2] target independent doc and tools rebuiltGaius Mulley12-54/+54
The target independent documentation needs to be rebuilt together with the bootstrap tools after the library changes and after the <* noreturn *> attribute has been implemented. gcc/m2/ChangeLog: * Make-maintainer.in (gm2.maintainer-clean): Remove. (gm2.maintainer-help): Add gm2.maintainer-tools, gm2.maintainer-doc. Remove gm2.maintainer-clean. Change target-independent directory to target-independent/m2. * gm2-compiler/ppg.mod: Correct __FILE_ typo to __FILE__. * gm2-compiler/M2Options.def (SetAutoInit): Update comment. * gm2-compiler/M2Options.mod (SetAutoInit): Update comment. * gm2-gcc/m2color.cc (m2color_colorize_start): Rename name_len to _name_high. * gm2-gcc/m2color.def (colorize_start): change ARRAY OF CHAR to ADDRESS and add _name_high. * gm2-gcc/m2decl.cc (m2decl_BuildStartFunctionDeclaration): Change int to bool. * gm2-gcc/m2decl.h (m2decl_BuildStartFunctionDeclaration): Change int to bool. * gm2-gcc/m2expr.cc (m2expr_BuildBinarySetDo): Change int to bool. (m2expr_BuildIfConstInVar): Change int to bool. (m2expr_BuildIfNotConstInVar): Change int to bool. (m2expr_BuildIfVarInVar): Change int to bool. (m2expr_BuildIfNotVarInVar): Change int to bool. (m2expr_BuildForeachWordInSetDoIfExpr): Change int to bool. * gm2-gcc/m2expr.h (m2expr_BuildIfNotVarInVar): Change int to bool. (m2expr_BuildIfVarInVar): Change int to bool. (m2expr_BuildIfNotConstInVar): Change int to bool. (m2expr_BuildIfConstInVar): Change int to bool. * gm2-gcc/m2options.h (M2Options_SetAutoInit): Change int to bool. (M2Options_SetNilCheck): Change int to bool. (M2Options_SetReturnCheck): Change int to bool. (M2Options_SetCaseCheck): Change int to bool. (M2Options_SetCheckAll): Change int to bool. (M2Options_SetVerboseUnbounded): Change int to bool. (M2Options_SetUnboundedByReference): Change int to bool. (M2Options_SetOptimizing): Change int to bool. (M2Options_SetQuiet): Change int to bool. (M2Options_SetCpp): Change int to bool. (M2Options_SetM2g): Change int to bool. (M2Options_SetLowerCaseKeywords): Change int to bool. (M2Options_SetVerbose): Change int to bool. * gm2-gcc/m2treelib.cc (m2treelib_get_rvalue): Change int to bool. (m2treelib_get_field_no): Change int to bool. (m2treelib_get_set_value): Change int to bool. (m2treelib_get_set_address): Change int to bool. (m2treelib_get_set_address_if_var): Change int to bool. * gm2-gcc/m2treelib.def (get_set_address_if_var): Change int to bool. (get_set_address): Change int to bool. (get_set_value): Change int to bool. (get_field_no): Change int to bool. (get_rvalue): Change int to bool. * gm2-gcc/m2treelib.h (m2treelib_get_field_no): Change int to bool. (m2treelib_get_set_value): Change int to bool. (m2treelib_get_set_address): Change int to bool. (m2treelib_get_set_address_if_var): Change int to bool. * gm2-gcc/m2type.cc (m2type_BuildEndFunctionType): Change int to bool. * gm2-gcc/m2type.h (m2type_BuildEndFunctionType): Change int to bool. * gm2-libs-ch/dtoa.cc (dtoa_calcsign): Change int to bool. * gm2-libs-ch/ldtoa.cc (dtoa_calcsign): Change int to bool. (ldtoa_ldtoa): Change int to bool. * m2.flex (functionInfo): Change int to bool. (pushFunction): Change parameter from int to bool. * mc-boot/GDebug.cc (Debug_Halt): Rebuild. * mc-boot/GDebug.h (Debug_Halt): Rebuild. * mc-boot/GDynamicStrings.cc: Rebuild. * mc-boot/GDynamicStrings.h: Rebuild. * mc-boot/GFIO.cc: Rebuild. * mc-boot/GM2RTS.cc: Rebuild. * mc-boot/GM2RTS.h: Rebuild. * mc-boot/GPushBackInput.cc: Rebuild. * mc-boot/GRTExceptions.cc: Rebuild. * mc-boot/GRTint.cc: Rebuild. * mc-boot/GSysStorage.cc: Rebuild. * mc-boot/Gdecl.cc: Rebuild. * mc-boot/GsymbolKey.cc: Rebuild. * mc/symbolKey.mod: Rebuild. * target-independent/m2/Builtins.texi: Rebuild. * target-independent/m2/SYSTEM-iso.texi: Rebuild. * target-independent/m2/SYSTEM-pim.texi: Rebuild. * target-independent/m2/gm2-libs.texi: Rebuild. * tools-src/def2doc.py (PIM_Log): Change gm2-libs-pim to gm2-lib-log. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2023-03-17PR modula2/109032 - message 'compiler checks to force' is too complicatedGaius Mulley1-7/+10
Correct typos and improve the descriptions of command line options. Improve comments in gm2-gcc/m2expr.cc. gcc/m2/ChangeLog: PR modula2/109032 * gm2-gcc/m2expr.cc: Correct ? : order in comments. (m2expr_BuildDivM2): Improve comment. * lang.opt: Improve option descriptions. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>