void test() {
  macro_args3(1);
  // CHECK: {{.*}}:43:15: warning: expression result unused
  // Also check that the 'caret' printing agrees with the location here where
  // its easy to FileCheck.
  // CHECK-NEXT: macro_args3(1);
  // CHECK-NEXT: ~~~~~~~~~~~~^~
  // CHECK: {{.*}}:36:36: note: expanded from macro: macro_args3
  // CHECK: {{.*}}:35:36: note: expanded from macro: macro_args2
  // CHECK: {{.*}}:34:24: note: expanded from macro: macro_args1

  macro_many_args3(
    1,
    2,
    3);
  // CHECK: {{.*}}:55:5: warning: expression result unused
  // CHECK: {{.*}}:40:55: note: expanded from macro: macro_many_args3
  // CHECK: {{.*}}:39:55: note: expanded from macro: macro_many_args2
  // CHECK: {{.*}}:38:35: note: expanded from macro: macro_many_args1

  macro_many_args3(
    1,
    M2,
    3);
  // CHECK: {{.*}}:64:5: warning: expression result unused
  // CHECK: {{.*}}:4:12: note: expanded from macro: M2
  // CHECK: {{.*}}:40:55: note: expanded from macro: macro_many_args3
  // CHECK: {{.*}}:39:55: note: expanded from macro: macro_many_args2
  // CHECK: {{.*}}:38:35: note: expanded from macro: macro_many_args1

  macro_many_args3(
    1,
    macro_args2(2),
    3);
  // CHECK: {{.*}}:74:17: warning: expression result unused
  // This caret location needs to be printed *inside* a different macro's
  // arguments.
  // CHECK-NEXT: macro_args2(2),
  // CHECK-NEXT: ~~~~~~~~~~~~^~~
  // CHECK: {{.*}}:35:36: note: expanded from macro: macro_args2
  // CHECK: {{.*}}:34:24: note: expanded from macro: macro_args1
  // CHECK: {{.*}}:40:55: note: expanded from macro: macro_many_args3
  // CHECK: {{.*}}:39:55: note: expanded from macro: macro_many_args2
  // CHECK: {{.*}}:38:35: note: expanded from macro: macro_many_args1
}
示例#2
0
void test() {
    macro_args3(11);
    // CHECK: {{.*}}:40:15: warning: expression result unused
    // Also check that the 'caret' printing agrees with the location here where
    // its easy to FileCheck.
    // CHECK-NEXT:      macro_args3(11);
    // CHECK-NEXT: {{^              \^~}}

    macro_many_args3(
        1,
        2,
        3);
    // CHECK: {{.*}}:49:5: warning: expression result unused
    // CHECK: {{.*}}:37:55: note: expanded from macro 'macro_many_args3'
    // CHECK: {{.*}}:36:55: note: expanded from macro 'macro_many_args2'
    // CHECK: {{.*}}:35:35: note: expanded from macro 'macro_many_args1'

    macro_many_args3(
        1,
        M2,
        3);
    // CHECK: {{.*}}:58:5: warning: expression result unused
    // CHECK: {{.*}}:4:12: note: expanded from macro 'M2'
    // CHECK: {{.*}}:37:55: note: expanded from macro 'macro_many_args3'
    // CHECK: {{.*}}:36:55: note: expanded from macro 'macro_many_args2'
    // CHECK: {{.*}}:35:35: note: expanded from macro 'macro_many_args1'

    macro_many_args3(
        1,
        macro_args2(22),
        3);
    // CHECK: {{.*}}:68:17: warning: expression result unused
    // This caret location needs to be printed *inside* a different macro's
    // arguments.
    // CHECK-NEXT:        macro_args2(22),
    // CHECK-NEXT: {{^                \^~}}
    // CHECK: {{.*}}:32:36: note: expanded from macro 'macro_args2'
    // CHECK: {{.*}}:31:24: note: expanded from macro 'macro_args1'
    // CHECK: {{.*}}:37:55: note: expanded from macro 'macro_many_args3'
    // CHECK: {{.*}}:36:55: note: expanded from macro 'macro_many_args2'
    // CHECK: {{.*}}:35:35: note: expanded from macro 'macro_many_args1'
}