The MASM Forum

Specialised Projects => Compiler Based Assembler => Topic started by: Emil_halim on April 10, 2018, 06:05:43 AM

Title: c-- name conflict
Post by: Emil_halim on April 10, 2018, 06:05:43 AM
Hi All

There are some c-- structure's names or member's names conflict with uasm keyword , such as 'Name'

so in my cmm2masm project , there are two solutions

1- i have to changing all conflicted keywords in all header's files , so hard mission!! also for users they must changing their structure's member or name

2- i can let cmm2masm to check that and prefix the conflict name with '_' char. , how can i get those keyword?

any help please?
Title: Re: c-- name conflict
Post by: habran on April 10, 2018, 04:51:36 PM
It is defined in coffspec.h

struct IMAGE_SECTION_HEADER {
    char Name[IMAGE_SIZEOF_SHORT_NAME];
    union {
        uint_32 PhysicalAddress;
        uint_32 VirtualSize;
    } Misc;
    uint_32 VirtualAddress;
    uint_32 SizeOfRawData;
    uint_32 PointerToRawData;
    uint_32 PointerToRelocations;
    uint_32 PointerToLinenumbers;
    uint_16 NumberOfRelocations;
    uint_16 NumberOfLinenumbers;
    uint_32 Characteristics;
};
Title: Re: c-- name conflict
Post by: Emil_halim on April 10, 2018, 11:35:14 PM
thanks habran.

where can i find all the conflict keywords?
Title: Re: c-- name conflict
Post by: habran on April 10, 2018, 11:51:18 PM
bin.c, coff.c, coffspec.h, pespec.h, preproc.c, sal.h
Title: Re: c-- name conflict
Post by: jj2007 on April 10, 2018, 11:54:10 PM
\Masm32\include\Windows.inc:
IMAGE_SECTION_HEADER STRUCT
    Name1 db IMAGE_SIZEOF_SHORT_NAME dup(?)
Title: Re: c-- name conflict
Post by: nidud on April 11, 2018, 12:00:46 AM
deleted
Title: Re: c-- name conflict
Post by: Emil_halim on April 11, 2018, 01:18:46 AM
thanks all,

Here is my function that return a non conflict name , also it fire a warning message.

char* keywrd[] = { "name","short","TYPE" };
int   keywrdnum = 3;
char keyCnflctName[255];

char* doConflictCheck(char* name)
{
   int k = 0;
   while (k < keywrdnum)
   {
      if (!stricmp(name, keywrd[k++]))
      {
         keyCnflctName[0] = '_';
         printf("warnning : found conflict object \'%s\' changed to \'_%s\'\n", name,name);
         return strcpy(keyCnflctName+1, name)-1;
      }
   }
   return  name;
}

i will increase it sooner , but if any one has faster one , please let me know.