This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

What does exactly -pedantic mean ??


I thought -pedantic was just an option to provide "pedantic" warnings.
I found a case where it changes the behaviour of the compiler:
>------------------

char dummy = 0x55;
char *addr = &dummy;

struct features {
 char _bit0:1;
 char _bit1:1;
 // ...
};

void fct(void) {
 union {
  char asc;
  features asf;
 } un;
 un.asf = *(volatile features *)addr;
}

<----------------

In the real application, volatile is used to force true access
to a hardware register.

xxx-gcc -Wall -c -o volatile.o volatile.cc
volatile.cc: In function `void fct()':
volatile.cc:16: warning: conversion from `volatile features' to `const
features &' discards volatile
volatile.cc:9: warning: in passing argument 1 of `features::operator
=(const features &)'

xxx-gcc -Wall -pedantic -c -o volatile.o volatile.cc
volatile.cc: In function `void fct()':
volatile.cc:16: no match for `features & = volatile features &'
volatile.cc:9: candidates are: features::operator =(const features &)
<near match>

Is this the normal behaviour ??

---------
Reading specs from
/thesee00/gnu/lib/gcc-lib/powerpc-wrs-vxworks5.3/egcs-2.91.53/specs
gcc version egcs-2.91.53 19980803 (gcc2 ss-980609 experimental)
---------
Reading specs from
/thesee00/gnu/lib/gcc-lib/sparc-sun-solaris2.5.1/egcs-2.91.51/specs
gcc version egcs-2.91.51 19980714 (gcc2 ss-980609 experimental)
---------
Both versions give the same output.

Nyny





Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]