The following error happens when compiling emc2 on a recent kernel:

hal/components/limit2.comp:14: error: expected identifier or ‘(’ before ‘{’ 
token
hal/components/limit2.comp: In function ‘_’:
hal/components/limit2.comp:22: warning: comparison of distinct pointer types 
lacks a cast
hal/components/limit2.comp:22: warning: comparison of distinct pointer types 
lacks a cast
make[2]: *** [/home/mb/emc2-cvs-trunk/src/objects/hal/components/limit2.o] 
Error 1
make[1]: *** [_module_/home/mb/emc2-cvs-trunk/src] Error 2
make: *** [modules] Error 2


This patch fixes emc2 compilation (stable and cvs trunk) on
a recent kernel (tested 2.6.26.7).
The kernel already defines a clamp() macro in linux/kernel.h.
In case the macro is defined, use it. It's a typesafe macro.

Somebody with commit access, please commit this.
Thanks.


Index: src/hal/components/limit2.comp
===================================================================
--- src.orig/hal/components/limit2.comp 2008-11-04 11:49:54.000000000 +0100
+++ src/hal/components/limit2.comp      2008-11-04 11:51:09.000000000 +0100
@@ -11,11 +11,14 @@
 
 typedef struct { float old_out; } limit2_data;
 
+#ifndef clamp
 static inline double clamp(double v, double sub, double sup) {
     if(v < sub) return sub;
     if(v > sup) return sup;
     return v;
 }
+#endif
+
 FUNCTION(_) {
     double tmp = in;
     double maxdelta = maxv * fperiod;

-- 
Greetings Michael.
Index: src/hal/components/limit2.comp
===================================================================
--- src.orig/hal/components/limit2.comp	2008-11-04 11:49:54.000000000 +0100
+++ src/hal/components/limit2.comp	2008-11-04 11:51:09.000000000 +0100
@@ -11,11 +11,14 @@
 
 typedef struct { float old_out; } limit2_data;
 
+#ifndef clamp
 static inline double clamp(double v, double sub, double sup) {
     if(v < sub) return sub;
     if(v > sup) return sup;
     return v;
 }
+#endif
+
 FUNCTION(_) {
     double tmp = in;
     double maxdelta = maxv * fperiod;
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Emc-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/emc-developers

Reply via email to