M2(1)
β¨ NAME β¨
Okay bestie, this is the GNU manual page for M2(1) πΈ and the star of the show is gm2, the GNU Modula-2 Compiler π
π¦ SYNOPSIS π¦
Nothing to see here, bestie π«₯ this section is blank in the original page.
π¦ DESCRIPTION π¦
Same deal, this one is empty too π no notes!
π OPTIONS π
Okay so this is the big one π For any input file, the file name suffix decides what kind of compilation happens. These are the input file names that are supported:
file.modβ Modula-2 implementation or program source files. Using a different source file extension for your project? Check out the-fmod=option π§file.defβ Modula-2 definition module source files. These don't get compiled on their own, ngl π In GNU Modula-2, definition modules are parsed as needed when program or implementation modules are compiled. Different extension? See the-fdef=option.
You can specify more than one input file on the gm2 command line π
-gβ create debugging information so debuggers likegdbcan inspect and control executables π-Iβ used to set the search path for definition and implementation modules πΊοΈ An example isgm2 -g -c -I.:../../libs foo.mod. If you don't specify this, the default path is the current directory followed by the appropriate language dialect library directories.-fobject-path=β sets the path for objects during the linking stage π§³ An example isgm2 -g -fobject-path=.:../../libs/O2 -I.:../../libs foo.mod. Pairing-Iwith-fobject-path=lets projects keep different styles of objects separate from their source. For example, you could compile implementation modules at different optimisation levels, with or without debugging, and keep them in separate directories. If-fobject-path=isn't specified, it's set internally using the path from-I. If-Iisn't specified either, it uses the current directory. In every case, the appropriate language dialect library directories get tacked onto the end of the path.-fdebug-builtinsβ call a real function instead of the builtin equivalent π§ This is super handy for debugging the parameter values passed to a builtin, since you can single step your code right into a real function.-fdump-system-exportsβ display all inbuilt system items π«£ This is an internal command line option.-fswigβ generate a swig interface file π-fsharedβ generate a shared library from the module π-fmakeinitβ generate the start up C++ code for the module π A file called_m2_modulename.cppgets created. This is an internal command line option.-fruntime-modules=β specify, as a comma separated list, the runtime modules and their order π§© These modules get initialised first, before any other modules in the application dependency. By default the list isStorage,SYSTEM,M2RTS,RTExceptions,IOLink. Heads up: these modules only get linked into your executable if they're actually required. So a long list of dependent modules won't change the size of your executable. It just sets the initialisation order should they be needed.-fnilβ generate code to detect accessing data through aNILpointer value π¨-fno-nilβ do not generate thatNILpointer detection code π-fwholedivβ generate code to detect whole number division by zero or modulus by zero β-fno-wholedivβ do not generate that division and modulus by zero detection code-findexβ generate code to check whether array index values are out of bounds π-fno-indexβ do not generate that array index bounds checking code-frangeβ generate code to check the assignment range, return value range, set range and constructor range π―-fno-rangeβ do not generate code to check the assignment range, return value range, set range and constructor range-freturnβ generate code to check that functions always exit with aRETURNand don't just fall out at the end πͺ-fcaseβ turns on compile time checking for whether aCASEstatement needs anELSEclause when one wasn't specified π§-fsoft-check-allβ turns on all runtime checks π This is the same as using-fnil-frange-findex-fwholediv-fcase-freturntogether.-fauto-initβ turns on auto initialisation of pointers toNILπͺ Whenever a block is created, every pointer declared within that scope has its address assigned toNIL.-fno-exceptionsβ turns off all generation of exception handling code π No references are made to the runtime exception libraries.-vβ display all calls to subsidiary programs, such as the C preprocessor, the GNU Modula-2 linker and compiler π£-fm2-statisticsβ generates quadruple information π That's the number of quadruples generated, the number remaining after optimisation, and the number of source lines compiled.-fm2-whole-programβ compile all implementation modules and the program module all at once π Heads up: you need to take care if you're compiling different dialect modules (especially with negative operands to modulus) β οΈ But when this is paired with-O3, it can deliver huge performance improvements π€-fm2-gβ improves the debugging experience for new programmers π§βπ The trade-off is thatnopinstructions get generated where necessary, so single stepping is precise over all code related keywords. For example, ending a list of nestedIFstatements maps multipleENDkeywords onto a sequence ofnopinstructions.-fm2-lower-caseβ render keywords in error messages using lower case π€-fmakelistβ only applicable when linking a program module π The compiler generates amodulename.lstfile that lists the initialisation order of all modules to be linked. The actual link does not happen. The GNU Modula-2 linker scans allIMPORTs, generates a list of dependencies, and produces an ordered list for initialisation. It'll probably get the order wrong if your project has cyclic dependencies, but the.lstfile is plain text and can be modified if needed. Once the.lstfile exists, the compiler can use it to link your project via the-fuselistoption. It has no effect if the-coption is present.fno-pthreadβ do not automatically link against the pthread library π§΅ This is likely useful ifgm2is configured as a cross compiler targeting embedded systems. By default, GNU Modula-2 uses the GCC pthread libraries to implement coroutines (see the SYSTEM implementation module).-fuselistβ oncegm2has been told to link the program module, this option uses the filemodulename.lstfor the initialisation order of modules π―-fcppβ preprocess the source withcpp -lang-asm -traditional-cppπ§Ό For further details about these options see. If-fcppis supplied, then all definition modules and implementation modules that get parsed will be preprocessed bycpp.-fisoβ turns on ISO standard features π Currently this enables the ISOSYSTEMmodule and changes the default library search path so the ISO libraries are searched before the PIM libraries. It also affects the behaviour of theDIVandMODoperators. See-fpimβ turns on PIM standard features π Currently this enables the PIMSYSTEMmodule and determines which identifiers are pervasive (declared in the base module). If no other-fpim[234]switch is used, then division and modulus operators behave as defined in PIM4. See-fpim2β turns on PIM-2 standard features π Currently this removesSIZEfrom being a pervasive identifier (declared in the base module), and placesSIZEin theSYSTEMmodule instead. It also affects the behaviour of theDIVandMODoperators. See-fpim3β turns on PIM-3 standard features π Currently this only affects the behaviour of theDIVandMODoperators. See-fpim4β turns on PIM-4 standard features π Currently this only affects the behaviour of theDIVandMODoperators. See-fpositive-mod-floor-divβ forces theDIVandMODoperators to behave as defined by PIM4 π« All modulus results are positive, and division results are rounded to the floor. See-flibs=β modifies the default library search path π The libraries you can supply arem2pim,m2iso,m2min,m2logandm2cor:m2pimβ the Programming in Modula-2 base librariesm2isoβ the ISO standard librariesm2minβ minimal library supportm2logβ the Logitech compatible librarym2corβ Programming in Modula-2 with coroutines
You can specify multiple libraries, comma separated, and precedence goes to the first one in the list. You don't need -flibs=m2pim or -flibs=m2iso if you also specify -fpim, -fpim2, -fpim3, -fpim4 or -fiso. Unless you're using -flibs=m2min, you should include m2pim, because it provides the base modules that all the other dialects use π«Ά
-fextended-opaqueβ allows opaque types to be implemented as any type π¦ This is a GNU Modula-2 extension, and it requires that the implementation module defining the opaque type is available so it can be resolved when compiling the module that imports the opaque type.-fsourcesβ displays the path to the source of each module π This can be used at compile time to check that the correct definition module is being used.-fmodulesβ displays the path to each module's object file ποΈ This option can only be invoked with the-coption. It's used to see where the objects are located when linking occurs.-fdef=β recognise the specified suffix as a definition module filename π The default implementation and module filename suffix is.def. If you use this option, GNU Modula-2 will still fall back to that default if a requested definition module isn't found.-fmod=β okay so this one lets you pick the suffix GNU Modula-2 treats as implementation and module filenames π The default is.mod. If you use this flag and the compiler needs to read an implementation module but your suffixed filename doesn't exist, it still falls back to.modπ«Ά-fxcodeβ every error and warning gets printed in the Xcode format, so everything shows up in that style β¨-fonlylinkβ only links the Modula-2 application and skips compiling the program module first π-funbounded-by-referenceβ this one is giving optimization π It tries to pass nonVARunbounded parameters by reference, which skips the implicit copy inside the callee procedure. The compiler only does this if, inside the callee, the parameter isn't written to, no address is calculated on the array, and it isn't passed as aVARparameter. You can still write code that breaks the 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 that procedure, and write to the location through the address parameter.
π Due to the dangerous nature of this option, it is not enabled when the -O option is specified.
-Wverbose-unboundedβ tells you which nonVARunbounded parameters will be passed by reference π It only does anything if-funbounded-by-referenceis also on the command line.-Wstudentsβ a bad-style checker made for new Modula-2 users πΈ It catches situations that could cause confusion and lead to mistakes, like variables with the same name declared in different scopes, and variables that look like keywords. Experienced users might find it a bit too aggressive π-Wpedanticβ the strict one π€ It makes the compiler reject nestedWITHstatements that reference the same record type, and it doesn't allow multiple imports of the same item from a module. It also checks that procedure variables are written to before they're read, that variables aren't only written but also read, and that variables are declared and used. If the compiler finds a variable being read before it's written, it stops with a message. It also checks thatFORloop indices aren't used outside the end of the loop without being reset.-Wpedantic-param-namesβ checks procedure parameter names in the definition module against their implementation module counterparts π¦ This isn't required in ISO or PIM versions of Modula-2, but it can be super useful, as long as you're doing it on purpose.-Wpedantic-castβ warns if the ISO system function is used and the size of the variable differs from the size of the type. This is legal in ISO Modula-2, but it can be dangerous π¬ Some people preferVALin these situations and saveCASTfor type changes on objects that are the same size.-Wunused-variableβ warns if a variable has been declared but never used π§Ή-Wunused-parameterβ warns if a parameter has been declared but never used π§Ή-Wallβ turns on all Modula-2 warnings, so you get the whole vibe check π₯
β¨ ENVIRONMENT β¨
Nothing is listed in this section, bestie π₯Ί
β¨ SEE ALSO β¨
gpl(7), gfdl(7), fsf-funding(7), gcc(1) and the Info entries for gm2 and gcc π
β¨ COPYRIGHT β¨
Copyright (c) 1999-2021 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). π
That's the whole page, bestie π¦ Thanks for hanging with me through the gcc-12 flags, dated 2022-02-22 and filed under M2(1). Stay iconic πβ¨
π¦ where this page comes from
- ubuntu jammy: gm2-12-aarch64-linux-gnu 12-20220222-1ubuntu1cross1
- π girlified by claude-haiku-5-5 on : a language model's rewrite of the original, under its terms