tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] tcc -v with mob date?


From: Antoni Gual Via
Subject: Re: [Tinycc-devel] tcc -v with mob date?
Date: Thu, 1 Dec 2022 21:42:59 +0100

I think the patch is a great idea but...
I have just compiled tcc for Windows from the last snapshot, using Dimitri's BusyBox. Tcc's file date has updated to today's and I have tried the asm instruction popcnt and the strtoull function . Both work correctly. But to my surprise tcc -v does'nt give a clue about the snapshot version. 
I know Christian's patch is not yet included in the snapshot (it's too soon..) and i can't have yet the user readable version format. What i see is not even the machine readable serial. For me the version is still  
tcc version 0.9.27 (x86_64 Windows)
I thought you should be aware of it.

Regards
Antonio

Missatge de Christian Jullien <eligis@orange.fr> del dia dc., 30 de nov. 2022 a les 9:02:
Format has been lost, patch is in attachment this time

-----Original Message-----
From: tinycc-devel-bounces+eligis=orange.fr@nongnu.org [mailto:tinycc-devel-bounces+eligis=orange.fr@nongnu.org] On Behalf Of Christian Jullien
Sent: Wednesday, November 30, 2022 07:26
To: jullien@eligis.com; tinycc-devel@nongnu.org
Subject: Re: [Tinycc-devel] tcc -v with mob date?

This one is simpler and gives better info

jullien@mobley:~/tinycc $ git diff
diff --git a/Makefile b/Makefile
index efe0885..7543962 100644
--- a/Makefile
+++ b/Makefile
@@ -241,9 +241,12 @@ $(TCC_FILES) : DEFINES += -DONE_SOURCE=0
 $(X)tccpp.o : $(TCCDEFS_H)
 endif

-GITHASH := $(shell git rev-parse >/dev/null 2>&1 && git rev-parse --short HEAD || echo no)
-ifneq ($(GITHASH),no)
-DEF_GITHASH := -DTCC_GITHASH="\"$(shell git rev-parse --abbrev-ref HEAD):$(GITHASH)$(shell git diff --quiet || echo '-mod')\""
+FROM_GIT := $(shell git rev-parse >/dev/null 2>&1 && echo yes || echo no)
+
+ifeq ($(FROM_GIT),yes)
+GITHASH:=$(shell git rev-parse --abbrev-ref HEAD):$(shell git rev-parse --short HEAD) $(shell git log -1 --pretty='format:%cI')
+GITHASH+=$(shell git diff --quiet || echo locally modified)
+DEF_GITHASH := -DTCC_GITHASH="\"$(GITHASH)\""
 endif

 ifeq ($(CONFIG_debug),yes)


For example, with this uncommitted patch, it gives:

jullien@mobley:~/tinycc $ ./tcc -v
tcc version 0.9.27 mob:ac0604a 2022-11-29T21:13:20+01:00 locally modified (AArch64 Darwin)

C.

-----Original Message-----
From: tinycc-devel-bounces+eligis=orange.fr@nongnu.org [mailto:tinycc-devel-bounces+eligis=orange.fr@nongnu.org] On Behalf Of Christian Jullien
Sent: Tuesday, November 29, 2022 12:10
To: tinycc-devel@nongnu.org
Subject: [Tinycc-devel] tcc -v with mob date?

Hi,

Currently, tcc –v displays the (mob) githash which helps to identify which this version comes from.
It is not however user friendly.

I would like to add last commit date as:

jullien@sims4:~/tinycc $ ./tcc -v
tcc version 0.9.27 mob:afcdaf1 on 2022-11-29T00:56:26-06:00 (ARM eabihf Linux)

Maintainers, can you please apply a patch similar to this one?

jullien@sims4:~/tinycc $ git diff
diff --git a/Makefile b/Makefile
index efe0885..6377570 100644
--- a/Makefile
+++ b/Makefile
@@ -243,7 +243,12 @@ endif

 GITHASH := $(shell git rev-parse >/dev/null 2>&1 && git rev-parse --short HEAD || echo no)
 ifneq ($(GITHASH),no)
-DEF_GITHASH := -DTCC_GITHASH="\"$(shell git rev-parse --abbrev-ref HEAD):$(GITHASH)$(shell git diff --quiet || echo '-mod')\""
+DEF_GITHASH := -DTCC_GITHASH="\"$(shell git rev-parse --abbrev-ref HEAD):$(GITHASH)$(shell git diff --quiet || echo '-modified')\""
+endif
+
+GITDATE := $(shell git log -1 >/dev/null 2>&1 && git log -1 --pretty='format:%cI' || echo no)
+ifneq ($(GITDATE),no)
+DEF_GITDATE := -DTCC_GITDATE="\"$(shell git log -1 --pretty='format:%cI')\""
 endif

 ifeq ($(CONFIG_debug),yes)
@@ -265,7 +270,7 @@ $(X)%.o : %.c $(LIBTCC_INC)

 # additional dependencies
 $(X)tcc.o : tcctools.c
-$(X)tcc.o : DEFINES += $(DEF_GITHASH)
+$(X)tcc.o : DEFINES += $(DEF_GITHASH) $(DEF_GITDATE)

 # Host Tiny C Compiler
 tcc$(EXESUF): tcc.o $(LIBTCC)
diff --git a/tcc.c b/tcc.c
index beef6fb..da460cf 100644
--- a/tcc.c
+++ b/tcc.c
@@ -155,6 +155,9 @@ static const char version[] =
     "tcc version "TCC_VERSION
 #ifdef TCC_GITHASH
     " "TCC_GITHASH
+#endif
+#ifdef TCC_GITDATE
+    " on "TCC_GITDATE
 #endif
     " ("
 #ifdef TCC_TARGET_I386


_______________________________________________
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


_______________________________________________
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel
_______________________________________________
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel

reply via email to

[Prev in Thread] Current Thread [Next in Thread]