From: Takashi Iwai Subject: Re: Re: CVS compile issue Date: Thu, 11 Aug 2005 16:35:44 +0200 Message-ID: References: Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Return-path: In-Reply-To: Sender: alsa-devel-admin@lists.sourceforge.net Errors-To: alsa-devel-admin@lists.sourceforge.net List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , List-Archive: To: Clemens Ladisch Cc: Raymond , alsa-devel@lists.sourceforge.net List-Id: alsa-devel@alsa-project.org At Thu, 11 Aug 2005 16:08:17 +0200 (METDST), Clemens Ladisch wrote: > > Takashi Iwai wrote: > > > Raymond wrote: > > > > > > There is a "division by zero" warning for drivers which include > > > "driver.h" on Kernel 2.4 > > > > > > /alsa/cvs/alsa-driver/include/adriver.h: In function `jiffies_to_msecs': > > > /alsa/cvs/alsa-driver/include/adriver.h:639: warning: division by zero > > > > Is it the line: > > else if (HZ > 1000 && !(HZ % 1000)) > > ==> return (j + (HZ / 1000) - 1)/(HZ / 1000); > > > > ?? Where HZ is defined/declared in your kernel? > > The HZ definition is OK. The problem is that gcc complains even when > the code gets optimized away. Ah, OK. It's a gcc bug then :) > The equivalent code in the 2.6 kernel uses #if, but that wouldn't work > with the SuSE kernels where HZ is a variable. How about to add #ifdef HZ and provide two version? #ifdef HZ static inline jiffies_to_msec() { #if HZ >= 1000... #endif } #else /* !HZ */ static inline jiffies_to_msec() { if (HZ >= 1000) ... } #endif /* HZ */ Takashi ------------------------------------------------------- SF.Net email is Sponsored by the Better Software Conference & EXPO September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf