Those are what are commonly known as cautionary accidentals. Sometimes you will see them with parentheses. They're commonly found in music that is freely or loosely tonal, atonal, or anything that can be seen as not being conventionally tonal, or just in a very chromatic section of a work for clarification.