Skip to content

support for GNU C hot+cold label attributes #46831

Open
@nickdesaulniers

Description

@nickdesaulniers
Bugzilla Link 47487
Version unspecified
OS All
Blocks #4440
CC @DougGregor,@isanbard,@jyknight,@zygoloid

Extended Description

https://gcc.gnu.org/onlinedocs/gcc/Label-Attributes.html#Label-Attributes
https://godbolt.org/z/Er3rP8

#include <stdio.h>
int foo(void) {
       asm goto ("some asm" : : : : NoError);

/* This branch (the fall-through from the asm) is less commonly used */
ErrorHandling: 
   __attribute__((cold, unused)); /* Semi-colon is required here */
   printf("error\n");
   return 0;

NoError:
   printf("no error\n");
   return 1;
}

clang:

warning: 'cold' attribute only applies to functions [-Wignored-attributes]
   __attribute__((cold, unused)); /* Semi-colon is required here */
                  ^

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugzillaIssues migrated from bugzillacextension:gnullvmUmbrella label for LLVM issues

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions