Custom Query (541 matches)

Filters
 
Or
 
  
 
Columns

Show under each result:


Results (7 - 9 of 541)

1 2 3 4 5 6 7 8 9 10 11 12 13
Ticket Resolution Summary Owner Reporter
#131 fixed math_constants.h:37:1: warning: "M_PI" redefined kevin baker
Description

gcc version 4.2.1 (Mac OS X 10.5.8) issues warnings like:

In file included from butterworth.c:46:
/Users/baker/Desktop/Software/Earthworm/earthworm-7.5svn/include/math_constants.h:37:1: warning: "M_PI" redefined
In file included from /usr/include/math.h:28,
                 from butterworth.c:44:
/usr/include/architecture/i386/math.h:533:1: warning: this is the location of the previous definition

This is because M_PI is already defined by math.h when it is redefined (to a different value) by include/math_constants.h.

To eliminate the warnings, conditionally define M_PI in include/math_constants.h:

/* Constants rounded for 21 decimals. */
#ifndef M_PI
#define M_PI        3.14159265358979323846
#endif

Additional information.

M_PI is not a part of the ISO C standard, but is defined by default by gcc in math.h. From the GNU C Library - Mathematics web page (http://ftp.gnu.org/old-gnu/Manuals/glibc-2.2.3/html_chapter/libc_19.html):

These constants come from the Unix98 standard and were also available in 4.4BSD; therefore they are only defined if
_BSD_SOURCE or _XOPEN_SOURCE=500, or a more general feature select macro, is defined. The default set of features
includes these constants. See section Feature Test Macros.

Microsoft Visual C does not define these constants by default, but will do so when _USE_MATH_DEFINES is defined. (See http://msdn.microsoft.com/en-us/library/4hwaceh6.aspx). To obtain the math.h definition of M_PI, one would have to edit every source file that include's math.h to define _USE_MATH_DEFINES before including math.h:

#define _USE_MATH_DEFINES // for C
#include <math.h>

or add -D_USE_MATH_DEFINES to the compiler command-line options. The latter is probably easiest, and can be selectively applied when compiling with Visual C.

#132 fixed Missing #include <string.h> kevin baker
Description

gcc version 4.2.1 (Mac OS X 10.5.8) issues warnings like:

warning: incompatible implicit declaration of built-in function ‘strcpy’

This is because the following C source files are missing an #include <string.h>:

src/archiving/cont_trig/initpars.c
src/seismic_processing/fir/filt1scn.c
src/seismic_processing/raypicker/rp_messaging.c
#133 fixed geolib.h:636: warning: conflicting types for built-in function ‘round’ somebody baker
Description

gcc version 4.2.1 (Mac OS X 10.5.8) issues warnings like:

In file included from archman.c:32:
lib/geolib.h:636: warning: conflicting types for built-in function ‘round’

This is because src/archiving/archman/lib/geolib.h contains a function prototype declaration for an undefined, and unused, round() function which conflicts with the C library round() function declared in math.h. The fix is to remove (shown commented-out here) the declaration of round() in src/archiving/archman/lib/geolib.h at line 636:

void restart_signal_handler (int sig_no);
#long round (double amount);
int run_programme (char *, int, int, struct Redirection *);
1 2 3 4 5 6 7 8 9 10 11 12 13
Note: See TracQuery for help on using queries.