This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

casts to a type other than an integral or enumeration type in a constant-expression


The latest eCos sources no longer build with the latest gcc.  The
problem can be tracked down to C++ code like the following in eCos:

  #include <signal.h>

  void foo (__sighandler_t __sighdl)
  {
    switch ((int) __sighdl)
      {
      case (int) SIG_DFL:
        ;
      case (int) SIG_IGN:
        ;
      }
  }

Using "gcc version 3.2 20020903 (Red Hat Linux 8.0 3.2-7)" I get:

  $ /usr/bin/g++ -c b.c
  $

Using "gcc version 3.4 20030211 (experimental)" I get:

  $ /usr/local/sourceware/bin/g++ -c b.c
  b.c: In function `void foo(void (*)(int))':
  b.c:7: error: a casts to a type other than an integral or enumeration type
     cannot appear in a constant-expression
  b.c:9: error: a casts to a type other than an integral or enumeration type
     cannot appear in a constant-expression
  $

Since it's unclear to me if this is a case of g++ becoming more picky
or the eCos code not being C++ compliant, I'm posting this to both the
eCos discussion list and the gcc bugs discussion list for comment.

If the compiler is correct, then I presume the eCos code needs to change
to something like:

    if (__sighdl == SIG_DFL)
      {
	...
      }
    else if (__sighdl == SIG_IGN)
      {
        ...
      }

-Fred

-- 
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss


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