Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.

Firefox compile error: va_copy

zoku88
Beginner
508 Views
Hello, I'm trying to compile firefox with icc.
Most of the problems experienced there are applicable to the newer version I am using.
However, I'm getting stuck at:
/home/zoku88/Documents/mozilla-central-icc/ipc/chromium/src/base/string_util.cc(895): error: expected an identifier
base_va_copy(backup_ap, ap);
Looking atipc/chromium/src/base/string_util.cc

template
static void StringAppendVT(StringType* dst,
const typename StringType::value_type* format,
va_list ap) {
// First try with a small fixed size buffer.
// This buffer size should be kept in sync with StringUtilTest.GrowBoundary
// and StringUtilTest.StringPrintfBounds.
typename StringType::value_type stack_buf[1024];
va_list backup_ap;
base_va_copy(backup_ap, ap);
I think the error comes fromipc/chromium/src/base/port.h
namespace base {
// It's possible for functions that use a va_list, such as StringPrintf, to
// invalidate the data in it upon use. The fix is to make a copy of the
// structure before using it and use that copy instead. va_copy is provided
// for this purpose. MSVC does not provide va_copy, so define an
// implementation here. It is not guaranteed that assignment is a copy, so the
// StringUtil.VariableArgsFunc unit test tests this capability.
// The C standard says that va_copy is a "macro", not a function. Trying to
// use va_list as ref args to a function, as above, breaks some machines.
# if defined(COMPILER_GCC)
# define base_va_copy(_a, _b) ::va_copy(_a, _b)
# elif defined(COMPILER_MSVC)
# define base_va_copy(_a, _b) (_a = _b)
# else
# error No va_copy for your compiler
# endif
} // namespace base
The first time I got this error, I added the flag:-Dva_copy=__builtin_va_copy , but that doesn't seem to help.
Also tried seeing what happens when I skip the compiler check in port.h and make it do only
# define base_va_copy(_a, _b) ::va_copy(_a, _b)
Or
# define base_va_copy(_a, _b) (_a = _b)
Neither of which work.
My whole .mozconfig file is
export CC="icc"
export CXX="icpc"
export CFLAGS="-xHOST -fomit-frame-pointer -fp-model fast=2 -ipo18 -w -Dva_copy=__builtin_va_copy"
export CXXFLAGS=$CFLAGS
ac_add_options --enable-optimize="-O2"
ac_add_options --disable-debug # Don't put debugging information in the binary.
ac_add_options --enable-static # Use these two options to make the build static,
ac_add_options --disable-shared # so it will be faster and smaller.
ac_add_options --disable-tests # tests take forever to build and are useless unless you're a Gecko developer.
mk_add_options MOZ_MAKE_FLAGS="-j4"
ac_add_options --x-includes=/usr/X11R6/include # The X11 includes are in /usr/X11R6/include (yeah, it detects them, but it's faster like this)
ac_add_options --x-libraries=/usr/X11R6/lib # The X11 libs are in /usr/X11R6/lib (see above)
if this helps.
EDIT: Should also add that I'm using icc12.0.4.191
0 Kudos
2 Replies
Judith_W_Intel
Employee
508 Views

I can reproduce the problem with the example below with 12.0 but not 12.1.

// the example gives error with icpc 12.0 butnot with 12.1
#include

#define base_va_copy(_a, _b) ::va_copy(_a, _b)

void foo(va_list ap)
{
va_list backup_ap;
base_va_copy(backup_ap, ap);
}

int main() {
return 0;
}

I think this describes the problem/fix:

In configurations with GCC_BUILTIN_VARARGS set to TRUE, the front end
supports GCC-like built-in variadic parameter operators like
__builtin_va_start and __builtin_va_arg. Previously, these operators
were implemented as keywords.
Now they're implemented as GNU built-in functions that are handled specially.
As a consequence of this change, a program can e.g. declare local
variables with the names of these operators, or, in C++ mode, qualify
the operator names with "::".

Please upgrade to 12.1. There are no more 12.0 updates.

Judy

0 Kudos
zoku88
Beginner
508 Views
Ok, thanks for the help. I will try upgrading then.
0 Kudos
Reply