GM2(1)
π GM2(1) Β· GNU π
β¨ NAME β¨
gm2 - The GNU Modula-2 Compiler π¦ okay so this is THE compiler for GNU Modula-2, bestie.
π SYNOPSIS π
The source page leaves this section totally empty π so there's no synopsis to share, sorry bestie.
πΈ DESCRIPTION πΈ
Same deal here, this section is blank in the source π nothing to add.
β¨ OPTIONS β¨
okay so the file name suffix is basically the main character here π whatever ending your input file has decides what kind of compilation happens. These are the input file names gm2 vibes with:
file.modβ Modula-2 implementation or program source files. If your project uses a different source file extension, check out-fmod=πfile.defβ Modula-2 definition module source files. These don't get compiled on their own π₯Ί GNU Modula-2 parses them whenever a program or implementation module needs them while compiling. Using a different extension in your project? See-fdef=β¨
You can specify more than one input file on the gm2 command line,
-gβ creates debugging info so debuggers like gdb can inspect and control your executables π-Iβ sets the search path for definition and implementation modules. Example:gm2 -g -c -I.:../../libs foo.mod. If you skip this one, the default path is the current directory followed by the right language dialect library directories ποΈ-fobject-path=β sets the path for objects during the linking stage. Example:gm2 -g -fobject-path=.:../../libs/O2 -I.:../../libs foo.mod. Pairing-Iwith-fobject-path=lets you keep different styles of objects separate from their source files. Like, you could compile implementation modules at different optimization levels, with or without debugging, and stash them in separate directories π§ If-fobject-path=isn't specified, it gets set internally from the-Ipath. If-Iwasn't specified either, it uses the current directory. Either way, the appropriate language dialect library directories get tacked onto the end of the path.-fdebug-builtinsβ calls a real function instead of the builtin equivalent. This is super useful for debugging parameter values passed to a builtin, since you can single step your code right into a real function π-fdump-system-exportsβ displays all inbuilt system items. Heads up, this one's an internal command line option π-fswigβ generates a swig interface file π-fsharedβ generates a shared library from the module π-fmakeinitβ generates the start up C++ code for the module, creating a file called_m2_modulename.cpp. Also an internal command line option π-fruntime-modules=β takes a comma separated list of the runtime modules and their order. These modules get initialized first, before any other modules in the application dependency. By default the list isStorage,SYSTEM,M2RTS,RTExceptions,IOLink. These modules only get linked into your executable if they're actually required, so a long list won't change the executable size. It just sets the initialisation order should they be needed π¦-fnilβ generates code to detect accessing data through aNILvalue pointer π‘οΈ-fno-nilβ does NOT generate thatNILpointer check π ββοΈ-fwholedivβ generates code to detect whole number division by zero or modulus by zero β-fno-wholedivβ does NOT generate that division or modulus by zero check-findexβ generates code to check whether array index values are out of bounds π-fno-indexβ does NOT generate that array index bounds check-frangeβ generates code to check the assignment range, return value range, set range and constructor range π―-fno-rangeβ does NOT generate any of those range checks-freturnβ generates code to check that functions always exit with aRETURNand never just fall out at the end π-fcaseβ turns on compile time checking for whether aCASEstatement needs anELSEclause when you didn't specify one π§-fsoft-check-allβ turns on ALL the runtime checks at once π₯ It's the same as invoking GNU Modula-2 with-fnil-frange-findex-fwholediv-fcase-freturn.-fauto-initβ turns on auto initialization of pointers to NIL. Whenever a block gets created, every pointer declared within that scope has its address assigned to NIL πΈ-fno-exceptionsβ turns off all generation of exception handling code. No references get made to the runtime exception libraries either π«-vβ displays all calls to subsidiary programs, like the C preprocessor and the GNU Modula-2 linker and compiler π£-fm2-statisticsβ generates quadruple information: the number of quadruples generated, the number remaining after optimisation, and the number of source lines compiled π-fm2-whole-programβ compiles all implementation modules and the program module at once. Be careful if you're compiling different dialect modules, especially with negative operands to modulus π But paired with-O3, this option can deliver huge performance improvements π-fm2-gβ improves the debugging experience for new programmers, at the expense of generatingnopinstructions if necessary. This makes sure single stepping is precise over all the code-related keywords. Like, when you end a list of nestedIFstatements, the multipleENDkeywords get mapped onto a sequence ofnopinstructions π§Έ-fm2-lower-caseβ renders keywords in error messages using lower case π-fmakelistβ only applies when linking a program module. The compiler generates amodulename.lstfile containing a list of the initialisation order for all modules that are going 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, so you can modify it if you need to π Once the.lstfile exists, the compiler can link your project using the-fuselistoption. It has no effect if the-coption is present.-fmod=β okay so this one tells GM2 to treat your chosen suffix as the filename ending for implementation and module files π The default suffix is.mod. If you use this flag, GM2 will still fall back to.modwhen it needs to read an implementation module and your suffixed file isn't there π¦-fxcodeβ main character energy β¨ it makes every error and warning come out in the Xcode format π-fonlylinkβ lowkey the most chill option π it only links your Modula-2 application and skips compiling the program module beforehand π§-funbounded-by-referenceβ this one is a whole vibe π₯ it turns on an optimization that tries to pass non"VAR"unbounded parameters by reference, so the implicit copy inside the callee procedure is skipped πΈ GM2 will only do this if, inside the callee, the parameter is never written to, no address is calculated on the array, and it isn't passed on as a"VAR"parameter π
β οΈ Be careful with this one, bestie. It's possible to write code that breaks this optimization, so use it with real care π 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 π
Because it's so risky π, this option is not enabled when the -O option is specified.
-Wverbose-unboundedβ the tell-me-everything flag π it informs you which non"VAR"unbounded parameters will be passed by reference π«Ά This only produces output if-funbounded-by-referenceis also on the command line, so don't expect it to say anything without that buddy π-Wstudentsβ a little style check, iykyk β¨ it looks for bad programming style and is aimed at new Modula-2 users, since it catches situations that could cause confusion and mistakes π§ It checks whether variables with the same name are declared in different scopes, and whether variables look like keywords π Experienced users might find it a bit too aggressive, ngl π-Wpedanticβ the strict auntie of warnings π It forces the compiler to reject nested"WITH"statements 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 being read, that variables aren't only written to but also read from, and that variables are declared and used π₯ If the compiler finds a variable being read before it's written, it will terminate with a message π It also checks that"FOR"loop indices aren't used outside the end of the loop without being reset π¦-Wpedantic-param-namesβ name-matching energy πΈ Procedure parameter names get checked in the definition module against their implementation module counterparts π«Ά This isn't needed in ISO or PIM versions of Modula-2, but it can be extremely useful, as long as you're intentionally writing code this way β¨-Wpedantic-castβ this one has receipts π§Ύ It warns if the ISO system function is used and the size of the variable is different from the size of the type π This is legal in ISO Modula-2, but it can be dangerous π¬ Some users prefer usingVALin these situations and usingCASTonly for changes in type on objects that have the same size π-Wunused-variableβ the clutter police π§Ή it warns if a variable has been declared and never used π-Wunused-parameterβ same energy, different target πΏ it warns if a parameter has been declared and never used π¦-Wallβ TURN ON EVERYTHING π this turns on all Modula-2 warnings, so get ready for a lot of feedback ππ
π§ ENVIRONMENT π§
This section is totally empty, bestie π« There's nothing in here for us to talk about π
π¦ SEE ALSO π¦
Check these out for more info, they're giving πβ¨: gpl(7), gfdl(7), fsf-funding(7), gcc(1) and the Info entries for gm2 and gcc π«Ά
π COPYRIGHT π
Copyright (c) 1999-2020 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 π There are 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 a wrap on GM2 π β¨ Thanks for reading along, bestie, you did amazing π«Ά Love you, mwah ππΈ
π¦ where this page comes from
- ubuntu noble: gm2-10-powerpc64le-linux-gnu 10.5.0-4ubuntu2.1cross1
- ubuntu noble: gm2-10-powerpc64le-linux-gnu 10.5.0-4ubuntu2cross1
- π girlified by claude-haiku-5-5 on : a language model's rewrite of the original, under its terms