0
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>

int main(void)
{
  int fd;
  fd = open("abc.txt", O_RDONLY);
  if (fd < 0)
  {
    exit(EXIT_FAILURE);
  }

  printf("fd %d\n", fd);
  close(fd);

  exit(EXIT_SUCCESS);  
}

Now I build it:

$ cc -errwarn=%all -o ~/tmp/aa ~/tmp/a.c
warning: bad message tag: /export/home/rmashak/tmp/a.call
$ cc -V
cc: Sun C 5.12 SunOS_i386 2011/11/16

It does execute fine, but what's the warning all about?

Mark
  • 6,052
  • 8
  • 61
  • 129

2 Answers2

0

I have insufficient reputation to add a comment... This does look like a compiler bug with the parser. Compiling with later version of cc does not produce this error.

$ cc -V                                 
cc: Sun C 5.13 SunOS_i386 2014/10/20
$ cc -errwarn=%all -o ~/tmp/aa ~/tmp/a.c
$ 

In your output cc appears to have presented the source filename concatenated with the remainder of '-errwarn' tag 'all', odd!

alls0rts
  • 248
  • 3
  • 9
0

The error means that you have passed an unrecognized option to -errwarn:

% cc -errwarn=%mumblefrotz -o hello hello.c
warning: bad message tag: %mumblefrotz

It appears your shell somehow converted the % in your command into /export/home/rmashak/tmp/a.c before passing it to the compiler. It looks like some shells such as zsh may expand % signs specially in command processing - check the docs for whichever shell you use.

If you're using recent versions of Solaris Studio, the % is optional to avoid problems like this - you can change your command instead to be:

cc -errwarn=all -o ~/tmp/aa ~/tmp/a.c
alanc
  • 4,102
  • 21
  • 24