Skip to content

Commit

Permalink
Add new Global hook for compiler vendor name.
Browse files Browse the repository at this point in the history
  • Loading branch information
Iain Buclaw committed May 7, 2013
1 parent 9592fc3 commit 1791d58
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/lexer.c
Expand Up @@ -672,7 +672,7 @@ void Lexer::scan(Token *t)
}
else if (id == Id::VENDOR)
{
t->ustring = (unsigned char *)"Digital Mars D";
t->ustring = (unsigned char *)global.compiler.vendor;
goto Lstr;
}
else if (id == Id::TIMESTAMP)
Expand Down
2 changes: 2 additions & 0 deletions src/mars.c
Expand Up @@ -98,6 +98,8 @@ Global::Global()
#include "verstr.h"
;

compiler.vendor = "Digital Mars D";

main_d = "__main.d";

structalign = STRUCTALIGN_DEFAULT;
Expand Down
6 changes: 6 additions & 0 deletions src/mars.h
Expand Up @@ -238,6 +238,11 @@ struct Param
char *mapfile;
};

struct Compiler
{
const char *vendor; // Compiler backend name
};

typedef unsigned structalign_t;
#define STRUCTALIGN_DEFAULT ~0 // magic value means "match whatever the underlying C compiler does"
// other values are all powers of 2
Expand All @@ -264,6 +269,7 @@ struct Global

const char *version;

Compiler compiler;
Param params;
unsigned errors; // number of errors reported so far
unsigned warnings; // number of warnings reported so far
Expand Down

0 comments on commit 1791d58

Please sign in to comment.