NO

Author Topic: compiler options  (Read 5380 times)

Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 2115
compiler options
« on: December 31, 2018, 06:08:59 PM »
Code: [Select]
#include <string.h>
#include "CCOpt.h"
int __cdecl main(void)
{
char s[] = "-Tx86-coff -Ot -W1 -Gd -std:C17 -Zi";
char *p = strtok(s, " ");
while (p) {
printf(p);
for (int i=0; i<sizeof(aCCOpt)/sizeof(aCCOpt[0]); i++) {
char *po = aCCOpt[i].opt;
if (!memcmp(po+1, p, *po)) {
printf("\t%s", aCCOpt[i].des);
break;
}
}
printf("\n");
p = strtok(NULL, " ");
}
return 0;
}
output:
Code: [Select]
-Tx86-coff      <target> Selects the target processor and output format.
-Ot     Optimizes for speed.
-W1     <n> Sets the warning level.
-Gd     Uses cdecl as the default calling convention.
-std:C17        <mode> Selects the active C standard, C17, C11 or C99 (default:C17).
-Zi     Emits full debugging information.
Press any key to continue...
CCOpt.h
Code: [Select]
struct  {
char *opt, *des, *ver;
} aCCOpt[] = {
        {"\006-arch:","<id> Selects the minimum processor architecture (X64), AVX, AVX2, or SSE2 (default: SSE2).","9.00"},
        {"\002-D","<name>[=<text>] Defines a preprocessor symbol."},
        {"\002-E","Runs the preprocessor only (to stdout)."},
        {"\003-Fo","<outfile> Specifies the name of the output file."},
        {"\004-fp:","<model> Sets the floating-point model, PRECISE or FAST (default: PRECISE).","5.00"},
        {"\003-Gd","Uses cdecl as the default calling convention."},
        {"\003-Gh","Emits hook function calls."},
        {"\003-Gi","Emits code to check for signed integer overflow.","7.00"},
        {"\003-Gm","Specifies no decoration of stdcall or fastcall symbols.","2.90.1"},
        {"\003-Gn","Specifies no decoration of exported stdcall symbols.","2.80"},
        {"\003-Go","Accepts 'old' names for C runtime functions.","2.70"},
        {"\003-Gr","Uses fastcall as the default calling convention.","2.90"},
        {"\003-Gz","Uses stdcall as the default calling convention."},
        {"\003-GA","Assumes _tls_index is zero, when using __declspec(thread).","6.00"},
        {"\003-GT","Generates fiber-safe access, when using __declspec(thread).","6.50"},
        {"\011-hotpatch","[:<n>] Emits code to support Microsoft hotpatching.","7.00"},
        {"\002-I","<path> Specifies a new path for #include files."},
        {"\002-J","Specifies that the default char type is unsigned."},
        {"\003-MD","Activates dynamic C runtime support.","2.90"},
        {"\003-MT","Activates multi-threading support."},
        {"\002-M","Runs the preprocessor only, then writes MAKE dependencies to stdout.","6.00"},
        {"\007-openmp","Activates OpenMP parallel extensions to C.","8.00"},
        {"\003-O1","Same as /Os (optimizes for size).","2.90"},
        {"\003-O2","Same as /Ot (optimizes for speed).","2.90"},
        {"\003-Ob","<n> Sets the inline expansion model.","6.00"},
        {"\003-Os","Optimizes for size."},
        {"\003-Ot","Optimizes for speed."},
        {"\003-Ox","Optimizes for newer processors.","2.00"},
        {"\002-P","Runs the preprocessor only (to file).","5.00"},
        {"\010-spectre","[:{1|2}] Enables mitigation against the Spectre vulnerability.","9.00"},
        {"\005-std:","<mode> Selects the active C standard, C17, C11 or C99 (default: C17).","7.00"},
        {"\002-T","<target> Selects the target processor and output format."},
        {"\002-U","<name> Undefines a preprocessor symbol."},
        {"\002-V","<n> Sets the verbosity level.","2.80"},
        {"\003-Wd","<n> Disables a compiler warning.","9.00"},
        {"\002-W","<n> Sets the warning level."},
        {"\002-X","Ignores standard places for #include files."},
        {"\003-Zd","Emits minimal debugging information."},
        {"\003-Ze","Activates Microsoft's extensions to C."},
        {"\003-Zg","Displays function prototypes on the screen."},
        {"\003-Zi","Emits full debugging information."},
        {"\003-Zl","Prevents linker directives from being emitted to the object file."},
        {"\003-Zs","Only performs a syntax check."},
        {"\003-Zx","Activates Pelle's extensions to C.","2.70"},
        {"\011-cbstring","Emits literal data to the code section (device drivers).","2.90"},
};
Code: [Select]
struct {
TCHAR *opt, *des, *ver;
}aCCOpt[]={
{TEXT("\006-arch:"),TEXT("<id> Selects the minimum processor architecture (X64), AVX, AVX2, or SSE2 (default: SSE2)."),TEXT("9.00")},
{TEXT("\002-D"),TEXT("<name>[=<text>] Defines a preprocessor symbol.")},
{TEXT("\002-E"),TEXT("Runs the preprocessor only (to stdout).")},
{TEXT("\003-Fo"),TEXT("<outfile> Specifies the name of the output file.")},
{TEXT("\004-fp:"),TEXT("<model> Sets the floating-point model, PRECISE or FAST (default: PRECISE)."),TEXT("5.00")},
{TEXT("\003-Gd"),TEXT("Uses cdecl as the default calling convention.")},
{TEXT("\003-Gh"),TEXT("Emits hook function calls.")},
{TEXT("\003-Gi"),TEXT("Emits code to check for signed integer overflow."),TEXT("7.00")},
{TEXT("\003-Gm"),TEXT("Specifies no decoration of stdcall or fastcall symbols."),TEXT("2.90.1")},
{TEXT("\003-Gn"),TEXT("Specifies no decoration of exported stdcall symbols."),TEXT("2.80")},
{TEXT("\003-Go"),TEXT("Accepts 'old' names for C runtime functions."),TEXT("2.70")},
{TEXT("\003-Gr"),TEXT("Uses fastcall as the default calling convention."),TEXT("2.90")},
{TEXT("\003-Gz"),TEXT("Uses stdcall as the default calling convention.")},
{TEXT("\003-GA"),TEXT("Assumes _tls_index is zero, when using __declspec(thread)."),TEXT("6.00")},
{TEXT("\003-GT"),TEXT("Generates fiber-safe access, when using __declspec(thread)."),TEXT("6.50")},
{TEXT("\011-hotpatch"),TEXT("[:<n>] Emits code to support Microsoft hotpatching."),TEXT("7.00")},
{TEXT("\002-I"),TEXT("<path>  Specifies a new path for #include files.")},
{TEXT("\002-J"),TEXT("Specifies that the default char type is unsigned.")},
{TEXT("\002-M"),TEXT("Runs the preprocessor only, then writes MAKE dependencies to stdout."),TEXT("6.00")},
{TEXT("\003-MD"),TEXT("Activates dynamic C runtime support."),TEXT("2.90")},
{TEXT("\003-MT"),TEXT("Activates multi-threading support.")},
{TEXT("\007-openmp"),TEXT("Activates OpenMP parallel extensions to C."),TEXT("8.00")},
{TEXT("\003-O1"),TEXT("Same as /Os (optimizes for size)."),TEXT("2.90")},
{TEXT("\003-O2"),TEXT("Same as /Ot (optimizes for speed)."),TEXT("2.90")},
{TEXT("\003-Ob"),TEXT("<n> Sets the inline expansion model."),TEXT("6.00")},
{TEXT("\003-Os"),TEXT("Optimizes for size.")},
{TEXT("\003-Ot"),TEXT("Optimizes for speed.")},
{TEXT("\003-Ox"),TEXT("Optimizes for newer processors."),TEXT("2.00")},
{TEXT("\002-P"),TEXT("Runs the preprocessor only (to file)."),TEXT("5.00")},
{TEXT("\010-spectre"),TEXT("[:{1|2}] Enables mitigation against the Spectre vulnerability."),TEXT("9.00")},
{TEXT("\005-std:"),TEXT("<mode> Selects the active C standard, C17, C11 or C99 (default: C17)."),TEXT("7.00")},
{TEXT("\002-T"),TEXT("<target> Selects the target processor and output format.")},
{TEXT("\002-U"),TEXT("<name> Undefines a preprocessor symbol.")},
{TEXT("\002-V"),TEXT("<n> Sets the verbosity level."),TEXT("2.80")},
{TEXT("\002-W"),TEXT("<n> Sets the warning level.")},
{TEXT("\003-Wd"),TEXT("<n> Disables a compiler warning."),TEXT("9.00")},
{TEXT("\002-X"),TEXT("Ignores standard places for #include files.")},
{TEXT("\003-Zd"),TEXT("Emits minimal debugging information.")},
{TEXT("\003-Ze"),TEXT("Activates Microsoft's extensions to C.")},
{TEXT("\003-Zg"),TEXT("Displays function prototypes on the screen.")},
{TEXT("\003-Zi"),TEXT("Emits full debugging information.")},
{TEXT("\003-Zl"),TEXT("Prevents linker directives from being emitted to the object file.")},
{TEXT("\003-Zs"),TEXT("Only performs a syntax check.")},
{TEXT("\003-Zx"),TEXT("Activates Pelle's extensions to C."),TEXT("2.70")},
{TEXT("\011-cbstring"),TEXT("Emits literal data to the code section (device drivers)."),TEXT("2.90")},
};
« Last Edit: January 01, 2019, 06:20:23 PM by TimoVJL »
May the source be with you