This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH REWORKED] gas: all: new macro directives: ifbin, ifconst, ifdec, iffloat, ifhex, ifnumber, ifquoted


.ifbin - check for digit in binary format (base 2)
.ifconst - check for constant or abs value
.ifdec - check for digit (base 10)
.iffloat - check for floating digit
.ifhex - check for hex digit (base 16)
.ifnumber - check for digit in format: bin, dec, float, hex
.ifquoted - check for string quoted by \" (not digits!)

[USAGE]
.section .text

.macro INVOKE arg1
  .set myvar, 1
  .ifquoted "\arg1\()"
    .warning "arg1 is string: \"\arg1\()\""
    .section .rodata
    tmp_string\@: .string "\arg1\()"
    # here we need to call a function with arg point to tmp_string\@
    .section .text
  .else
    .ifconst "\arg1\()"
      .warning "arg1 is const: \"\arg1\()\""
    .endif;
    .ifhex "\arg1\()"
      .warning "arg1 is hex: \"\arg1\()\""
    .endif;
    .iffloat "\arg1\()"
      .warning "arg1 is float: \"\arg1\()\""
    .endif;
  .endif;
.endm;

INVOKE "hello world !" # quoted string

INVOKE 45646h # const, hex

INVOKE $321.999 # not const, float
[/USAGE]

--
the best regards

Attachment: new-macro-directives.diff
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]