M2(1)
โจ M2(1) from GNU โจ
Okay bestie, this is the M2(1) page from the GNU manual, and it's all about gm2, the GNU Modula-2 Compiler ๐๐ฆ
๐ธ NAME ๐ธ
gm2 - The GNU Modula-2 Compiler ๐
๐ง SYNOPSIS ๐ง
This one's empty in the original page, so there's nothing to see here ๐
๐ DESCRIPTION ๐
This section is also blank in the original, so we're skipping straight to the good stuff โจ
๐ OPTIONS ๐
okay so for any input file, the file name suffix decides what kind of compilation happens ๐ฅ these are the file types gm2 supports:
file.modโ Modula-2 implementation or program source files ๐ if your project uses a different source extension, check out-fmod=๐ซถfile.defโ Modula-2 definition module source files ๐ these don't get compiled on their own. In GNU Modula-2, definition modules are parsed whenever a program or implementation module needs them โจ if your project uses a different extension, check out-fdef=๐
You can specify more than one input file on the gm2 command line,
Now for the options, periodt ๐ โจ
-gโ creates debugging info so debuggers like gdb can inspect and control the executable ๐๐ฆ-Iโ sets the search path for definition and implementation modules ๐บ๏ธ for example:gm2 -g -c -I.:../../libs foo.mod. If you don't set this, the default path is the current directory followed by the right language dialect library directories ๐ธ-fauto-initโ turns on auto initialization of pointers to NIL ๐งธ every time a block gets created, all the pointers declared in that scope get their addresses set to NIL ๐-fboundsโ turns on run time checks for subranges, array indexes, and indirection through a NIL pointer ๐ก๏ธ-fcaseโ compile time checking to see whether aCASEstatement needs anELSEclause when you didn't write one ๐-fcppโ preprocesses the source withcpp -lang-asm -traditional-cpp๐งน For further details about these options, check the cpp docs ๐ If you pass-fcpp, every definition and implementation module that gets parsed will be preprocessed by cpp ๐ซถ-fdebug-builtinsโ calls a real function instead of the builtin equivalent ๐ This is super handy for debugging the parameter values going into a builtin function, since you can single step into an intrinsic function ๐พ-fdef=โ recognizes the suffix you give as a definition module filename ๐ท The default implementation and module filename suffix is .def. If you use this option, GNU Modula-2 still falls back to that default when a requested definition module isn't found ๐-fdump-system-exportsโ displays all inbuilt system items ๐งพ This one is an internal command line option, so it's more of a behind-the-scenes thing ๐-fexceptionsโ turns on exception handling code ๐ It's on by default ๐ You can turn it off with-fno-exceptions, and then no references get made to the run time exception libraries ๐-fextended-opaqueโ lets opaque types be implemented as any type ๐ฆ This is a GNU Modula-2 extension, and it needs the implementation module that defines the opaque type to be available, so it can be resolved when the module importing that opaque type gets compiled ๐งฉ-ffloatvalueโ turns on run time checking to see whether a floating point number is about to go out of range ๐-fgen-module-list=filenameโ tries to find all modules at link time and generates a module list ๐ If the filename is-, the contents aren't written and the option is only used to force linking of all module ctors ๐ซ You can't use this option if-fuse-list=is enabled ๐ซ-findexโ generates code to check whether array index values are out of bounds ๐ข You can disable it with-fno-index๐ โโ๏ธ-fisoโ turns on ISO standard features ๐ Right now this enables the ISOSYSTEMmodule and changes the default library search path so the ISO libraries get searched before the PIM libraries ๐ It also changes how theDIVandMODoperators behave ๐งฎ-flibs=โ modifies the default library search path ๐ค๏ธ The libraries you can pick are: m2pim, m2iso, m2min, m2log and m2cor ๐ These map onto the Programming in Modula-2 base libraries, the ISO standard libraries, minimal library support, the Logitech compatible library, and Programming in Modula-2 with coroutines ๐งต You can list several, separated by commas, and the first one in the list gets precedence ๐ You don't need-flibs=m2pimor-flibs=m2isoif you also specify-fpim,-fpim2,-fpim3,-fpim4or-fiso๐ซถ Unless you're using-flibs=m2min, you should include m2pim, because it provides the base modules that all the other dialects use ๐ธ The option-fno-libs=-stops the gm2 driver from touching the search and library paths ๐ โโ๏ธ-static-libgm2โ on systems that offer the m2 runtimes as both shared and static libraries, this forces the static version ๐ชจ-fm2-gโ makes debugging easier for new programmers ๐ฃ The trade-off is that it may generatenopinstructions, so you can single step precisely through all the code-related keywords ๐ฃ For example, when a list of nestedIFstatements ends with severalENDkeywords, those get mapped onto a sequence ofnopinstructions ๐ฅฑ-fm2-lower-caseโ shows keywords in error messages in lower case ๐ค-fm2-pathname=โ sets the module mangled prefix name for all modules in the include paths that follow ๐ท๏ธ-fm2-pathnameIโ for internal use only ๐คซ The driver uses it to copy the user-facing-Ioption ๐-fm2-pluginโ inserts a plugin that identifies run time errors at compile time ๐ต๏ธโโ๏ธ It's on by default โ-fm2-prefix=โ sets the module mangled prefix name ๐ช Every exported symbol from a definition module will get that prefix ๐-fm2-statisticsโ generates quadruple information ๐ That's the number of quadruples generated, the number of quadruples left after optimization, and the number of source lines compiled ๐งฎ-fm2-strict-typeโ an experimental flag that turns on the new strict type checker ๐งช โ ๏ธ Still experimental, so use it with caution ๐-fm2-whole-programโ compiles all implementation modules and the program module all at once ๐โโ๏ธ๐จ
Be careful here, bestie! You need to take care if you're compiling different dialect modules, especially with negative operands to modulus ๐จ But when you pair this option with -O3, it can deliver huge performance improvements ๐
-fmod=โ recognizes the suffix you give as implementation and module filenames ๐ท The default implementation and module filename suffix is .mod. If you use this option, GNU Modula-2 still falls back to that default when it needs to read an implementation module and the suffixed filename you gave doesn't exist ๐ซถ-fnilโ generates code to detect data access through a NIL value pointer ๐ณ๏ธ You can turn off dereference checking through a NIL pointer with-fno-nil๐ โโ๏ธ-fpimโ turns on PIM standard features ๐ Right now this enables the PIMSYSTEMmodule and decides which identifiers are pervasive (declared in the base module) ๐ If you don't use any other-fpim[234]switch, division and modulus behave the way PIM4 defines them ๐งฎ-fpim2โ turns on PIM-2 standard features ๐ Right now this removesSIZEfrom being a pervasive identifier (declared in the base module) ๐ โโ๏ธ It movesSIZEinto theSYSTEMmodule instead ๐ฆ It also changes how theDIVandMODoperators behave ๐งฎ-fpim3โ turns on PIM-3 standard features ๐ Right now this only changes how theDIVandMODoperators behave ๐งฎ-fpim4โ turns on PIM-4 standard features ๐ Right now this only changes how theDIVandMODoperators behave ๐งฎ-fpositive-mod-floor-divโ forcesDIVandMODto behave the way PIM4 defines them โจ All modulus results come out positive, and division results get rounded to the floor ๐ธ-fpthreadโ links against the pthread library ๐งต It's on by default, and you can disable it with-fno-pthread๐ โโ๏ธ GNU Modula-2 uses the GCC pthread libraries to implement coroutines, so check out the SYSTEM implementation module if you want the details ๐ซถ-frangeโ generates code to check the assignment range, return value range, set range and constructor range ๐ You can disable range checking with-fno-range๐ โโ๏ธ-freturnโ generates code to check that functions always exit with aRETURNand don't just fall out the end ๐ช You can disable return checking with-fno-return๐ โโ๏ธ-fruntime-modules=โ takes a comma separated list that sets the run time modules and their order ๐งพ These modules get initialized first, before any other modules in the application dependency ๐ฅ By default the list ism2iso:RTentity,m2iso:Storage,m2iso:SYSTEM,m2iso:M2RTS,m2iso:RTExceptions,m2iso:IOLink๐ These modules only get linked into your executable if they're actually required ๐ง Adding a long list of dependent modules won't change the size of the executable, it just states the initialization order in case they're needed ๐ฆ-fscaffold-dynamicโ makes sure gm2 generates a dynamic scaffold infrastructure when compiling implementation and program modules ๐๏ธ It's on by default ๐ Use-fno-scaffold-dynamicto turn it off, or pick-fno-scaffold-staticinstead ๐-fscaffold-cโ generates a C source scaffold for the module you're compiling right now ๐ฑ-fscaffold-c++โ generates a C++ source scaffold for the module you're compiling right now ๐-fscaffold-mainโ forces the generation of the main function ๐ฏ You don't need this if-cis omitted ๐-fscaffold-staticโ makes sure gm2 generates a static scaffold within the program module ๐งฑ The static scaffold is made of sequences of calls to all dependent module initialization and finalization procedures ๐ It's really useful for debugging and single stepping through the initialization blocks of implementation modules ๐ฃ-fsharedโ generates a shared library from the module ๐ค-fsoft-check-allโ turns on all run time checks ๐ก๏ธโจ This is the same as invoking GNU Modula-2 with-fnil-frange-findex-fwholevalue-fwholediv-fcase-freturn๐-fsourcesโ displays the path to the source of each module ๐๏ธ You can use it at compile time to double check that the right definition module is being used ๐-fswigโ generates a swig interface file ๐ชถ-funbounded-by-referenceโ Okay bestie, this one is a speed boost for unbounded parameters ๐. It tries to pass nonVARunbounded parameters by reference, so the callee doesn't make its own implicit copy. GNU Modula-2 only does this if, inside the callee, the parameter is never written to, no address is calculated on the array, and it isn't passed as aVARparameter. ngl, it's still possible to write code that breaks this optimization, so use it carefully ๐ . For example, you could take the address of an array, pass both the address and the array to a procedure, read from the array inside the procedure, and write to that location through the address parameter. Chaotic ๐
Due to the dangerous nature of this option, it is not enabled when the-Ooption is specified. Don't go looking for it under-O๐
-fuse-list=filenameโ Use the filefilenameto set the initialization order of modules, but only if-fscaffold-staticis enabled ๐๏ธ. If-fscaffold-dynamicis enabled instead, this file is used to force linking of all module ctors ๐. This option cannot be used if-fgen-module-list=is enabled.-fwholedivโ Generates code that detects whole number division by zero and modulus by zero ๐งฎ. Bestie, that's a safety net โจ.-fwholevalueโ Generates code that detects whole number overflow and underflow ๐๐. No surprise numbers sneaking up on you ๐ซถ.-Wcase-enumโ Gives you a warning if aCASEstatement selects on an enumerated type expression and it's missing one or moreCASElabels ๐. If theCASEstatement has a defaultELSEclause, no warning is issued, so you're covered. The-Walloption turns this flag on for you ๐.-Wuninit-variable-checkingโ Warns you if a variable gets used before it's initialized ๐ซฃ. The checking only happens in the first basic block of each procedure. It doesn't check parameters, array types or set types, so those are on their own ๐.-Wuninit-variable-checking=all,known,condโ Same vibe of warning, but with more levels ๐๏ธ. The checking only happens in the first basic block of each procedure ifknownis specified. Ifcondorallis specified, the checking keeps going into conditional branches of the flow graph ๐. All checking stops when a procedure call is invoked or when the top of a loop is encountered ๐. The-Walloption turns this flag on with-Wuninit-variable-checking=known. Heads up that-Wuninit-variable-checking=allwill increase compile time โณ.
๐ SEE ALSO ๐
gpl(7),gfdl(7),fsf-funding(7),gcc(1)and the Info entries forgm2andgcc๐โจ
๐ COPYRIGHT ๐
Copyright (c) 1999-2024 Free Software Foundation, Inc. ๐
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation, with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the man page gfdl(7) ๐ฆ.
Okay that's the whole page, bestie ๐ It's gcc-14 energy, dated 2024-04-12, and it's M2(1) forever ๐๐
๐ฆ where this page comes from
- ubuntu noble: gm2-14-sparc64-linux-gnu 14-20240412-0ubuntu1cross1
- ๐ girlified by claude-haiku-5-5 on : a language model's rewrite of the original, under its terms