[ofw] [PATCH] Cleanup MTHCA atomic_set function
Fab Tillier
ftillier at windows.microsoft.com
Fri Jul 11 11:10:14 PDT 2008
> From: Smith, Stan [mailto:stan.smith at intel.com]
> Sent: Friday, July 11, 2008 10:21 AM
>
> Why is seeing the warning C4197 OK, as warnings are treated as errors,
> thus the build fails?
Here's the diff that added the 'warning supression' code (from that revision we all love, 1091):
svn diff -r 268:1091 hw\mthca\kernel\mt_atomic.h
Index: hw/mthca/kernel/mt_atomic.h
===================================================================
--- hw/mthca/kernel/mt_atomic.h (revision 268)
+++ hw/mthca/kernel/mt_atomic.h (revision 1091)
@@ -15,7 +15,7 @@
static inline void atomic_set(atomic_t *pval, long val)
{
- *pval = (atomic_t)val;
+ *pval = *(atomic_t *)&val; //to avoid C4197
}
/**
The original code cast val into atomic_t, but atomic_t is typedefed as volatile, thus the warning (I'm guessing). I'm honestly not sure what the issue was, I just saw this and it made me cringe so I had to clean it up.
-Fab
More information about the ofw
mailing list