/* Undefine the following on a release-tag: */
#define GMQCC_VERSION_TYPE_DEVEL
+/* Full version string in case we need it */
+#ifdef GMQCC_GITINFO
+# define GMQCC_DEV_VERSION_STRING "git build: " GMQCC_GITINFO "\n"
+#elif defined(GMQCC_VERSION_TYPE_DEVEL
+# define GMQCC_DEV_VERSION_STRING "development build\n"
+#else
+# define GMQCC_DEV_VERSION_STRING
+#endif
+
+#define GMQCC_STRINGIFY(x) #x
+#define GMQCC_IND_STRING(x) GMQCC_STRINGIFY(x)
+#define GMQCC_FULL_VERSION_STRING \
+"GMQCC " \
+GMQCC_IND_STRING(GMQCC_VERSION_MAJOR) "." \
+GMQCC_IND_STRING(GMQCC_VERSION_MINOR) "." \
+GMQCC_IND_STRING(GMQCC_VERSION_PATCH) \
+" Built " __DATE__ " " __TIME__ \
+"\n" GMQCC_DEV_VERSION_STRING
+
/*
* We cannot rely on C99 at all, since compilers like MSVC
* simply don't support it. We define our own boolean type
uint16_t forced_crc; /* --force-crc= */
bool pp_only; /* -E */
size_t max_array_size; /* --max-array= */
+ bool add_info; /* --add-info */
uint32_t flags [1 + (COUNT_FLAGS / 32)];
uint32_t warn [1 + (COUNT_WARNINGS / 32)];
opts.quiet = true;
break;
}
+ else if (!strcmp(argv[0]+2, "add-info")) {
+ opts.add_info = true;
+ break;
+ }
else {
/* All long options with arguments */
if (options_long_witharg("output", &argc, &argv, &argarg)) {
ast_value *imm_float_one;
ast_value *imm_vector_zero;
ast_value *nil;
+ ast_value *reserved_version;
size_t crc_globals;
size_t crc_fields;
parser->const_vec[0] = ast_value_new(empty_ctx, "<vector.x>", TYPE_NOEXPR);
parser->const_vec[1] = ast_value_new(empty_ctx, "<vector.y>", TYPE_NOEXPR);
parser->const_vec[2] = ast_value_new(empty_ctx, "<vector.z>", TYPE_NOEXPR);
+
+ if (opts.add_info) {
+ parser->reserved_version = ast_value_new(empty_ctx, "reserved:version", TYPE_STRING);
+ parser->reserved_version->cvq = CV_CONST;
+ parser->reserved_version->hasvalue = true;
+ parser->reserved_version->expression.flags |= AST_FLAG_INCLUDE_DEF;
+ parser->reserved_version->constval.vstring = util_strdup(GMQCC_FULL_VERSION_STRING);
+ } else {
+ parser->reserved_version = NULL;
+ }
return true;
}
return false;
}
}
+ if (parser->reserved_version &&
+ !ast_global_codegen(parser->reserved_version, ir, false))
+ {
+ con_out("failed to generate reserved::version");
+ ir_builder_delete(ir);
+ return false;
+ }
for (i = 0; i < vec_size(parser->imm_float); ++i) {
if (!ast_global_codegen(parser->imm_float[i], ir, false)) {
con_out("failed to generate global %s\n", parser->imm_float[i]->name);