Bug 1748874 Comment 2 Edit History

Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.

It's a little bit complex than that, the thumb rule is that the declaration should get it, not the definition. That means there's no problem if the definition itself is a declaration.

```cpp
// No problem, everything is good
MOZ_CAN_RUN_SCRIPT static void foo();

static void bar() {
  foo();
}
```

```cpp
static void foo();

static void bar() {
  foo(); // !! bar() doesn't know foo is MOZ_CAN_RUN_SCRIPT
}

MOZ_CAN_RUN_SCRIPT foo() {};
```
It's a little bit complex than that, the thumb rule is that the declaration should get it, not the definition. That means there's no problem if the definition itself is a declaration.

```cpp
// No problem, everything is good
MOZ_CAN_RUN_SCRIPT static void foo();

static void bar() { // MOZ_CAN_RUN_SCRIPT error as expected
  foo();
}
```

```cpp
static void foo();

static void bar() {
  foo(); // !! bar() doesn't know foo is MOZ_CAN_RUN_SCRIPT
}

MOZ_CAN_RUN_SCRIPT foo() {};
```

Back to Bug 1748874 Comment 2