static void test(const char *t1, const char *t2,int resexp) { boolean res = is_strstrnocase(t1,t2); if (res == resexp) { return; } printf("Error,mismatch %s and %s. Expected %d got %d\n", t1,t2,resexp,res); }
/* Record which compiler was used (or notice we saw it before) and set a couple variables as a side effect (which are used all over): current_cu_is_checked_compiler (used in checking_this_compiler() ) current_compiler The compiler name is from DW_AT_producer. */ void update_compiler_target(const char *producer_name) { boolean cFound = FALSE; int index = 0; safe_strcpy(glflags.CU_producer,sizeof(glflags.CU_producer),producer_name, strlen(producer_name)); current_cu_is_checked_compiler = FALSE; /* This list of compilers is just a start: GCC id : "GNU" SNC id : "SN Systems" */ /* Find a compiler version to check */ if (compilers_targeted_count) { for (index = 1; index <= compilers_targeted_count; ++index) { if (is_strstrnocase(glflags.CU_producer, compilers_targeted[index].name)) { compilers_targeted[index].verified = TRUE; current_cu_is_checked_compiler = TRUE; break; } } } else { /* Internally the strings do not include quotes */ boolean snc_compiler = hasprefix(glflags.CU_producer,"SN") ? TRUE : FALSE; boolean gcc_compiler = hasprefix(glflags.CU_producer,"GNU") ? TRUE : FALSE; current_cu_is_checked_compiler = glflags.gf_check_all_compilers || (snc_compiler && glflags.gf_check_snc_compiler) || (gcc_compiler && glflags.gf_check_gcc_compiler) ; } /* Check for already detected compiler */ for (index = 1; index <= compilers_detected_count; ++index) { if ( #if _WIN32 !stricmp(compilers_detected[index].name,glflags.CU_producer) #else !strcmp(compilers_detected[index].name,glflags.CU_producer) #endif /* _WIN32 */ ) { /* Set current compiler index */ current_compiler = index; cFound = TRUE; break; } } if (!cFound) { /* Record a new detected compiler name. */ if (compilers_detected_count + 1 < COMPILER_TABLE_MAX) { Compiler *pCompiler = 0; char *cmp = makename(glflags.CU_producer); /* Set current compiler index, first compiler at position [1] */ current_compiler = ++compilers_detected_count; pCompiler = &compilers_detected[current_compiler]; reset_compiler_entry(pCompiler); pCompiler->name = cmp; } } }