Hey,

Attached is a patch which we could use to provide version info.

The cegcc.h include file is built automatically when a release is
created, and stored in SVN. The build script does all the magic.

I've worked with a two-phased system :
- both our compilers define __CEGCC_VERSION__, without value
- the include file detects this macro and gives it a value

In addition to this, we could also provide a runtime function in the
cegcc.dll for instance : extern int _CeGCCVersion(void);
which might be defined as
  int _CeGCCVersion(void)
  {
        return __CEGCC_VERSION__;
  }

In this way, the DLL version can be checked by an application. We'd also
have to hide this in some DLL for mingw32ce.

This is just a proposal. Comments please.

        Danny
-- 
Danny Backx ; danny.backx - at - scarlet.be ; http://danny.backx.info
Index: scripts/make_release.sh
===================================================================
--- scripts/make_release.sh	(revision 1061)
+++ scripts/make_release.sh	(working copy)
@@ -172,6 +172,42 @@
 	#
 	#	End level 10 (create source tag in SVN)
 	#
+	RESTARTED=11
+	report_status
+	#
+fi
+
+#
+# Level 11
+#
+if test $RESTARTED -ge 12
+then
+	echo "Skip level 11 (create version include file)"
+else
+	echo "Level 11 (create version include file)"
+
+	OK=no
+	TS1=`date +%Y%m%d`
+	cd $SVN_TAGS/cegcc-$VERSION/src/w32api/includes
+	CEGCC_VERSION_MAJOR=`echo $VERSION | awk -F. '{print $1}'`
+	CEGCC_VERSION_MINOR=`echo $VERSION | awk -F. '{print $2}'`
+	CEGCC_VERSION_PATCHLEVEL=`echo $VERSION | awk -F. '{print $3}'`
+	L1=`grep -s -n "Automatic changes below" cegcc.h.in | awk -F: '{print $1}'`
+	L2=`grep -s -n "Automatic changes above" cegcc.h.in | awk -F: '{print $1}'`
+	head -$L1 cegcc.h.in >cegcc.h
+	echo "#define   __CEGCC_VERSION_MAJOR__ " $CEGCC_VERSION_MAJOR >> cegcc.h
+	echo "#define   __CEGCC_VERSION_MINOR__ " $CEGCC_VERSION_MINOR >> cegcc.h
+	echo "#define   __CEGCC_VERSION_PATCHLEVEL__ " $CEGCC_VERSION_PATCHLEVEL >> cegcc.h
+	echo "#define   __CEGCC_BUILD_DATE__" `date +%Y%m%d` >> cegcc.h
+	tail +$L2 cegcc.h.in >>cegcc.h
+	svn commit cegcc.h -m "Version file for release $VERSION" && OK=yes
+	if [ $OK = "no" ]; then
+		echo "SVN commit failed, exiting..."
+		exit 1
+	fi
+	#
+	#	End level 11 (create version include file)
+	#
 	RESTARTED=20
 	report_status
 	#
Index: src/w32api/include/cegcc.h.in
===================================================================
--- src/w32api/include/cegcc.h.in	(revision 0)
+++ src/w32api/include/cegcc.h.in	(revision 0)
@@ -0,0 +1,35 @@
+/*
+ * Version information about CeGCC
+ */
+#ifndef	_CEGCC_H_
+#define	_CEGCC_H_
+
+#ifndef __CEGCC_VERSION__
+#error __CEGCC_VERSION__ isn't defined by the compiler. Huh?
+#endif
+
+#undef __CEGCC_VERSION__
+
+/* Automatic changes below */
+#define	__CEGCC_VERSION_MAJOR__	9
+#define	__CEGCC_VERSION_MINOR__ 99
+#define	__CEGCC_VERSION_PATCHLEVEL__ 9
+#define	__CEGCC_BUILD_DATE__ 99999999
+/* Automatic changes above */
+
+#define	__CEGCC_VERSION__	\
+	(((__CEGCC_VERSION_MAJOR__) << 16)
+	 + ((__CEGCC_VERSION_MINOR__) << 8)
+	 + (__CEGCC_PATCHLEVEL__))
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern int _CeGCCVersion(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif	/* _CEGCC_H_ */

Property changes on: src/w32api/include/cegcc.h.in
___________________________________________________________________
Name: svn:eol-style
   + native

Index: src/gcc/gcc/config/arm/wince-pe.h
===================================================================
--- src/gcc/gcc/config/arm/wince-pe.h	(revision 1061)
+++ src/gcc/gcc/config/arm/wince-pe.h	(working copy)
@@ -50,7 +50,7 @@
 
 #undef CPP_SPEC
 #define CPP_SPEC "%(cpp_cpu) \
--DWIN32 -D_WIN32 -D__WIN32 -D__WIN32__ \
+-DWIN32 -D_WIN32 -D__WIN32 -D__WIN32__ -D__CEGCC_VERSION__ \
 %{!nostdinc: -idirafter ../include/w32api%s -idirafter ../../include/w32api%s } \
 "
 
@@ -252,7 +252,7 @@
   do									\
     {									\
       char *eh;								\
-      eh = arm_exception_handler(STREAM, NAME, DECL);			\
+      eh = arm_pe_exception_handler(STREAM, NAME, DECL);		\
       if (eh)								\
         {								\
           asm_fprintf (STREAM, "%@ %s has exception handler %s\n",	\
@@ -282,6 +282,6 @@
 #undef  ASM_DECLARE_FUNCTION_SIZE
 #define ASM_DECLARE_FUNCTION_SIZE(STREAM, NAME, DECL)			\
     {									\
-	if (arm_exception_handler(STREAM, NAME, DECL))			\
+	if (arm_pe_exception_handler(STREAM, NAME, DECL))		\
 		asm_fprintf (STREAM, ".L%s_end:\n", NAME);		\
     }
Index: src/gcc/gcc/config/arm/mingw32.h
===================================================================
--- src/gcc/gcc/config/arm/mingw32.h	(revision 1071)
+++ src/gcc/gcc/config/arm/mingw32.h	(working copy)
@@ -35,7 +35,7 @@
 
 #undef CPP_SPEC
 #define CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{mthreads:-D_MT} \
--D__COREDLL__ -D__MINGW32__ -D__MINGW32CE__ \
+-D__COREDLL__ -D__MINGW32__ -D__MINGW32CE__ -D__CEGCC_VERSION__ \
 %{!nostdinc: -idirafter ../include/w32api%s -idirafter ../../include/w32api%s }"
 
 #undef LIB_SPEC
Index: src/gcc/gcc/config/arm/wince-cegcc.h
===================================================================
--- src/gcc/gcc/config/arm/wince-cegcc.h	(revision 1061)
+++ src/gcc/gcc/config/arm/wince-cegcc.h	(working copy)
@@ -28,7 +28,8 @@
 
 #undef CPP_SPEC
 #define CPP_SPEC "%(cpp_cpu) %{posix:-D_POSIX_SOURCE} \
-  -D__CEGCC32__ -D__CEGCC__ %{!ansi:-Dunix} -D__unix__ -D__unix \
+  -D__CEGCC32__ -D__CEGCC__ -D__CEGCC_VERSION__ \
+  %{!ansi:-Dunix} -D__unix__ -D__unix \
   %{mwin32: -DWIN32 -D_WIN32 -D__WIN32 -D__WIN32__ } \
   %{!nostdinc:%{!mno-win32: -idirafter ../include/w32api%s -idirafter ../../include/w32api%s }} \
 "
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Cegcc-devel mailing list
Cegcc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cegcc-devel

Reply via email to